Repository: macvim-dev/macvim

Issue #109: Launching MacVim.app shows no window; mvim at shell launches but cannot open new windows
Created: 2015-11-04T18:03:32Z
This is a similar problem to #24.
At some point recently for me, opening Macvim via /Applications/MacVim.app no longer works. I initially installed MacVim via homebrew (with a simple brew install macvim and brew linkapps macvim). I've been having this issue before installing El Capitan.
Opening MacVim via mvim at the shell works, although note that this launches exec /usr/local/Cellar/macvim/7.4-79/MacVim.app/Contents/MacOS/Vim -g as opposed to exec /usr/local/Cellar/macvim/7.4-79/MacVim.app/Contents/MacOS/MacVim. However opening a new editor window in this launched MacVim with command-N or any other command does not work.
:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov  4 2015 12:55:10)
MacOS X (unix) version
Included patches: 1-903
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +clipboard       +cursorshape     +extra_search    -gettext         +lispindent      +mouse_dec       +multi_lang      +profile         +smartindent     -tcl             +virtualedit     -X11
+arabic          +cmdline_compl   +dialog_con_gui  +farsi           -hangul_input    +listcmds        -mouse_gpm       -mzscheme        +python          -sniff           +terminfo        +visual          -xfontset
+autocmd         +cmdline_hist    +diff            +file_in_path    +iconv           +localmap        -mouse_jsbterm   +netbeans_intg   -python3         +startuptime     +termresponse    +visualextra     +xim
+balloon_eval    +cmdline_info    +digraphs        +find_in_path    +insert_expand   -lua             +mouse_netterm   +odbeditor       +quickfix        +statusline      +textobjects     +viminfo         -xsmp
+browse          +comments        +dnd             +float           +jumplist        +menu            +mouse_sgr       +path_extra      +reltime         -sun_workshop    +title           +vreplace        -xterm_clipboard
++builtin_terms  +conceal         -ebcdic          +folding         +keymap          +mksession       -mouse_sysmouse  +perl            +rightleft       +syntax          +toolbar         +wildignore      -xterm_save
+byte_offset     +cryptv          +emacs_tags      -footer          +langmap         +modify_fname    +mouse_urxvt     +persistent_undo +ruby            +tag_binary      +transparency    +wildmenu        -xpm
+cindent         +cscope          +eval            +fork()          +libcall         +mouse           +mouse_xterm     +postscript      +scrollbind      +tag_old_static  +user_commands   +windows
+clientserver    +cursorbind      +ex_extra        +fullscreen      +linebreak       +mouseshape      +multi_byte      +printer         +signs           -tag_any_white   +vertsplit       +writebackup
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -F/usr/local/Cellar/python/2.7.10_2/Frameworks -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include
/python2.7 -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/D
eveloper/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -F/usr/local/Cellar/python/2.7.10_2/Frameworks -L/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -framework CoreFoundation -Wl,-sy
slibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa   -fstac
k-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.10_2/Frameworks -framework Python   -framework Ruby

I've also done defaults delete org.vim.MacVim as mentioned in #66 but this has no effect for me.

Duplicate issue #66: MacVim fails to initialize properly if the last saved window position is outside of current screen
Created: 2015-08-21T11:24:49Z
I've had Macvim failed to create its first window a couple of times with:
2015-08-21 12:16:53.910 MacVim[23324:151631] Error (1000) creating CGSWindow on line 281
2015-08-21 12:16:53.912 MacVim[23324:151631] (
        0   CoreFoundation                      0x00007fff937d103c __exceptionPreprocess + 172
        1   libobjc.A.dylib                     0x00007fff90cbc76e objc_exception_throw + 43
        2   CoreFoundation                      0x00007fff937d0eed +[NSException raise:format:] + 205
        3   AppKit                              0x00007fff98e86cc2 _NSCreateWindowWithOpaqueShape2 + 1417
        4   AppKit                              0x00007fff98e84f48 -[NSWindow _commonAwake] + 1877
        5   AppKit                              0x00007fff98f0fa19 -[NSWindow _makeKeyRegardlessOfVisibility] + 85
        6   AppKit                              0x00007fff98f0f98e -[NSWindow makeKeyAndOrderFront:] + 27
        7   MacVim                              0x000000010823481d -[MMWindowController presentWindow:] + 147
        8   Foundation                          0x00007fff9673b4eb __NSFireDelayedPerform + 364
        9   CoreFoundation                      0x00007fff937242e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
        10  CoreFoundation                      0x00007fff93723f73 __CFRunLoopDoTimer + 1059
        11  CoreFoundation                      0x00007fff9379753d __CFRunLoopDoTimers + 301
        12  CoreFoundation                      0x00007fff936df608 __CFRunLoopRun + 2024
        13  CoreFoundation                      0x00007fff936debd8 CFRunLoopRunSpecific + 296
        14  HIToolbox                           0x00007fff8fbc656f RunCurrentEventLoopInMode + 235
        15  HIToolbox                           0x00007fff8fbc62ea ReceiveNextEventCommon + 431
        16  HIToolbox                           0x00007fff8fbc612b _BlockUntilNextEventMatchingListInModeWithFilter + 71
        17  AppKit                              0x00007fff98e738ab _DPSNextEvent + 978
        18  AppKit                              0x00007fff98e72e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
        19  AppKit                              0x00007fff98e68af3 -[NSApplication run] + 594
        20  AppKit                              0x00007fff98de5244 NSApplicationMain + 1832
        21  libdyld.dylib                       0x00007fff8cbbd5c9 start + 1

As a result the process keeps running, but there's no UI to interact with.
I've traced it down to MacVim trying to restore its window in a place that is outside of current screen. This happens when I work on a macbook with a large external display connected, quit MacVim, disconnect the display, then try to launch MacVim again.
$ defaults read org.vim.MacVim MMTopLeftPoint
{4, 1577}
$ osascript -e 'tell application "Finder" to get bounds of window of desktop'
0, 0, 1680, 1050

Removing the setting makes MacVim happy again and allows it to initialize properly:
$ defaults delete org.vim.MacVim MMTopLeftPoint

It'd be nice if MacVim would realise this on its own and didn't fail during window creation. :)

Closing comment (2015-12-19T04:16:44Z): @georgesnelling you said "Then launch macvim: no window.", not the crash. It sounds the exactly same as #109.