resizing the macvim window

131 views
Skip to first unread message

James Hardee

unread,
Mar 4, 2021, 10:19:21 AM3/4/21
to vim_mac

Hi all! I'm a linux user somewhat new to modern MacOS so sorry for the (possibly?) n00b question.

When i go to resize the window for macvim, it appears to resize incrementally based on the size of a cursor. I am wondering if there is a way to change this?

I am using the magnet app for window snapping and when i "maximize" the window there is a gap at the bottom between the macvim window and the bottom of my display.

here is a picture of the gap, next to firefox to demonstrate the difference:

Screen Shot 2021-03-03 at 2.47.11 PM.png

any help would be greatly appreciated, I know it seems like a non-issue but it's really been bugging me.

Thanks!

Tony Mechelynck

unread,
Mar 4, 2021, 10:34:09 AM3/4/21
to vim_mac

Have you tried setting the 'lines' and 'columns' options? I am not on a Mac, but I have used gvim on both Linux and Windows, and there the line

        set lines=999 columns=9999

in my vimrc would maximize the window (to within one character cell of the edges) at startup (then gvim would set 'lines' and 'columns' to what was actually used, since it would never exceed the actual display size). Similarly,

        :set lines=25 columns=80

(followed by Enter) ought to resize the MacVim screen to only 25 lines by 80 columns, which nowadays feels tiny but was standard some decades ago on monochrome terminals.


Best regards,
Tony.

Tony Mechelynck

unread,
Mar 4, 2021, 10:39:38 AM3/4/21
to vim_mac
P.S. The size of the Firefox window is measured in pixels. The size of the MacVim screen (not including the window decorations, whose width is constant) is measured in characters. This comes from the different philosophy of these applications and is expected.

Best regards,
Tony.

Yee Cheng Chin

unread,
Mar 4, 2021, 5:47:36 PM3/4/21
to vim...@googlegroups.com
That's because MacVim currently rounds the window size to fixed multiples of character sizes. FWIW, I believe the built-in terminal and iTerm2 both do the same thing.

I do want to fix it, and have some local fixes, but it needs a little more work and testing, and I kind of want to think about whether to make it an option/default. "guioption-k" should probably be set as well to make this behave nicely if I add this option. You can use https://github.com/macvim-dev/macvim/issues/948 to track progress on this.

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_mac/68d756b9-6899-43ee-9825-c970cee9574fn%40googlegroups.com.

Tony Mechelynck

unread,
Mar 5, 2021, 5:16:40 AM3/5/21
to vim_mac
All Vim GUIs describe their screen sizes in terms of character cells. Some of them (including IIRC GTK2 and GTK3; I'm not sure about Windows and I don't know about MacVim) fill up the whole display when you click the "Maximize" button in one of the top corners, but in any case this only adds a few unused pixels along the borders, because Vim basically works with fixed-size character cells, using one cell for most characters, two cells for "wide CJK" characters, and between one and 'tabstop' cells for a hard tab, but never a noninteger number of cells. Even GTK2/GTK3 gvim, which can use any font, look ugly when using a proportional font, because the character cells are still of fixed size, which means that "wider" characters like m look cramped while "narrower" characters like i and l (small I and small L) seem to be surrounded by too much empty space. This property of using character cells of fixed size (a size which, in GUI Vim like gvim and MacVim, can only be changed by changing the 'guifont' setting) is so basic a property of Vim (and of Legacy vi before it IIUC) that I expect it never to change for as long as Vim will exist.

Best regards,
Tony.

Yee Cheng Chin

unread,
Mar 5, 2021, 5:50:34 AM3/5/21
to vim...@googlegroups.com
As you mentioned, Vim already supports a mode where the window size is not a strict multiples of character cell sizes, when maximized. There are special cases in the code base to handle that already, and for the most part maximized windows look fine. If you do "set guioptions+=k", and then change font size, add/remove tabs etc, Vim is also going to keep the window size fixed, and display some empty space along the borders. This is just going to make regular windowed mode support that in MacVim as well.

I really think it will look more natural once it's rolled out. Let's say your monitor is 1080 pixels tall and your font size is 14 pixels, that means you will have 77 rows = 1078 pixels tall (I'm ignoring things like windows border here). You still need to fill those 2 pixels somehow. The current GVim (which MacVim is doing) is to let the desktop or whatever window below the GVim window show through, which is distracting. If you let Vim's window size be more flexible, you can fill those 2 pixels with GVim itself which just draws the background color (this part is implementation specific) in the bottom right and will look much more seamless. Also, in general, I think a native application should try to respect the window manager's will as much as possible.

Proportional font: Sure, I think that's a different discussion. The issue here is mostly whether we want GVim to be able to fill the empty space to the side (we are not changing the actual character cell size here).

--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages