Skip to content

Commit 4657a8c

Browse files
committed
New defaults: Smoothly resize window, guioptions+=k
Change MacVim defaults to smoothly resize the window (instead of setting a resize constraint based on the grid size). Main motivation for this change is that this aligns to how most modern terminal emulators and Neovim GUIs and text editors work, and MacVim is implemented to still look nice while being smoothly resized. It also works better with the window manager. In particular, macOS 15 Sequoia introduced window tiling that allows you to pin a window to a side/corner of the screen. When a window is tiled, macOS actually actively ignores the resize constraint and allows the user to resize the window smoothly even if the window otherwise cannot be. There were also previous bugs with exiting native full screen and third-party snapping tools not working well with non-smooth resize. It's simply better to just default to this more intuitive option. - To get old behavior back: Go to "Settings…" and uncheck "Smoothly resizes window" under "General". Add "k" to `guioptions` setting in Vim. This works well with smooth resize and has similar rationale. It makes it so that when adding/removing a scrollbar or tab bar, MacVim wouldn't resize itself. Instead, it resizes the Vim window within it to accommodate. This again aligns more with how most apps work, and works better when tiled to a side of the screen. - To get old behavior back: Add `set guioptions-=k` to vimrc. See macvim-dev#1277 for more discussions on defaults.
1 parent 2ed23bb commit 4657a8c

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

runtime/doc/options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4198,6 +4198,7 @@ A jump table for the options with a short description can be found at |Q_op|.
41984198
'guioptions' 'go' string (default "egmrLtT" (MS-Windows,
41994199
"t" is removed in |defaults.vim|),
42004200
"aegimrLtT" (GTK and Motif),
4201+
"egmrLk" (MacVim),
42014202
)
42024203
global
42034204
{only available when compiled with GUI enabled}

src/MacVim/Base.lproj/Preferences.xib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
<button id="f9h-8n-asD" userLabel="allow smooth resizing">
196196
<rect key="frame" x="188" y="-1" width="258" height="18"/>
197197
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
198-
<string key="toolTip">Smoothly resizes MacVim's window instead of fixing it to the grid size. It's also recommended to set "guioptions+=k" in your vimrc when this is set.</string>
198+
<string key="toolTip">Smoothly resizes MacVim's window instead of snapping it to increments of the cell size. It's also recommended to have "guioptions+=k" set in Vim when this is on.</string>
199199
<buttonCell key="cell" type="check" title="Smoothly resizes window" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="4YN-AX-Vrz">
200200
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
201201
<font key="font" metaFont="system"/>

src/MacVim/MMAppController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ + (void)registerDefaults
233233
[NSNumber numberWithBool:NO], MMNonNativeFullScreenShowMenuKey,
234234
[NSNumber numberWithInt:0], MMNonNativeFullScreenSafeAreaBehaviorKey,
235235
[NSNumber numberWithBool:YES], MMShareFindPboardKey,
236-
[NSNumber numberWithBool:NO], MMSmoothResizeKey,
236+
[NSNumber numberWithBool:YES], MMSmoothResizeKey,
237237
[NSNumber numberWithBool:NO], MMCmdLineAlignBottomKey,
238238
[NSNumber numberWithBool:NO], MMRendererClipToRowKey,
239239
[NSNumber numberWithBool:YES], MMAllowForceClickLookUpKey,

src/MacVim/MacVimTests/MacVimTests.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,6 @@ - (void) fullScreenTestWithNative:(BOOL)native {
863863

864864
// In native full screen, non-smooth resize is more of an edge case due to
865865
// macOS's handling of resize constraints. Set this option to exercise that.
866-
// Also, when we are setting guifont, we don't cause it to resize the window.
867866
[self setDefault:MMSmoothResizeKey toValue:@NO];
868867

869868
[self createTestVimWindow];
@@ -874,7 +873,7 @@ - (void) fullScreenTestWithNative:(BOOL)native {
874873

875874
const int numRows = MMMinRows + 10;
876875
const int numColumns = MMMinColumns + 10;
877-
[self sendStringToVim:@":set guifont=Menlo:h10\n" withMods:0];
876+
[self sendStringToVim:@":set guioptions-=k guifont=Menlo:h10\n" withMods:0];
878877
[self waitForEventHandlingAndVimProcess];
879878
[self sendStringToVim:[NSString stringWithFormat:@":set lines=%d columns=%d\n", numRows, numColumns] withMods:0];
880879
[self waitForEventHandlingAndVimProcess];

src/optiondefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ static struct vimoption options[] =
13151315
#if defined(FEAT_GUI)
13161316
(char_u *)&p_go, PV_NONE, did_set_guioptions, expand_set_guioptions,
13171317
# ifdef FEAT_GUI_MACVIM
1318-
{(char_u *)"egmrL", (char_u *)0L}
1318+
{(char_u *)"egmrLk", (char_u *)0L}
13191319
# elif defined(UNIX)
13201320
{(char_u *)"aegimrLtT", (char_u *)0L}
13211321
# else

src/testdir/test_gui.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ func Test_set_guioptions()
720720
elseif has('gui_macvim')
721721
" Default Value
722722
set guioptions&
723-
call assert_equal('egmrL', &guioptions)
723+
call assert_equal('egmrLk', &guioptions)
724724

725725
else
726726
" Default Value

0 commit comments

Comments
 (0)