10

I have been using MacVim in graphical mode for several weeks now but I am quite disappointed with its start time.

When I run MacVim as an OSx App bundle then it starts for several seconds. The same goes for opening a new window. I read somewhere that it's because of Vim starts new process for every window and it might be caused by plugins, which are being loaded during every startup, slowing it down.

I don't think that's the case because when I execute MacVim via terminal command then it starts almost instantly.

Does anybody know how to speed the app-start process or where the problem might be?

Thanks.

Update

MacVim was installed through Homebrew, mvim leads to /usr/local/bin/mvim -> ../Cellar/macvim/7.4-94/bin/mvim, which is a bash script, thar runs ..Cellar/macvim/7.4-94/MacVim.app/Contents/MacOS/Vim binary with -g switch. Next to it is MacVim binary, which is somehow needed by Vim binary, because when I tried to move it, it stopped working properly. It seems that when 'Vim -g' is started then it's loaded instantly, but MacVim starts slowly and also any new window opened from already running 'Vim' app starts slowly.

Martin Macak
  • 3,507
  • 2
  • 30
  • 54
  • [faq](https://vimhelp.appspot.com/vim_faq.txt.html#faq-32.5) – Christian Brabandt Feb 12 '16 at 08:39
  • I don't know how this is related to the question. MacVim starts quite quickly with GUI when invoked via binary (like `mvim`) but when opened through App bundle (like `open MacVim`) then it takes a lot of time. – Martin Macak Feb 12 '16 at 08:44
  • 1
    At the moment it's very unclear. Is it the *same* vim the bundle and the command line start? Maybe there are conflicts. Where did you get the bundle? (is it trustworthy?) Whats in your vimrc? Are there multiple vimrcs? And that's just from the top of my head. – bdecaf Feb 12 '16 at 09:47
  • 1
    MacVim was installed through Homebrew, `mvim` leads to `/usr/local/bin/mvim -> ../Cellar/macvim/7.4-94/bin/mvim`, which is a bash script, thar runs `..Cellar/macvim/7.4-94/MacVim.app/Contents/MacOS/Vim` binary with `-g` switch. Next to it is `MacVim` binary, which is somehow needed by `Vim` binary, because when I tried to move it, it stopped working properly. It seems that when 'Vim -g' is started then it's loaded instantly, but `MacVim` starts slowly and also any new window opened from already running 'Vim' app starts slowly. – Martin Macak Feb 12 '16 at 17:01
  • is the VIM_APP_DIR set (top of the mvim script)? The mvim script depends on this variable being set, otherwise it takes its time checking various 'suspected' paths. I believe vim -g is fast because it doesn't fork. – gregory Jan 27 '17 at 16:28
  • Any findings on this? I still get really slow startup on macVim, and from terminal it's faster – hyouuu Nov 21 '17 at 19:59

3 Answers3

3

I had the same problem with MacVim taking 5-10 seconds to open a new window. I do have a couple of plugins, but nothing crazy. The same vimrc/plugins I have used on both Windows and Linux versions of Vim and works fine there with no slowness.

There is an option called "Quickstart" in MacVim's preferences dialog, which tells MacVim NOT to reprocess the vimrc/startup scripts for each new window. The only consequence is that if you make changes to your .vim/ stuff, it won't take effect in new windows until you restart the whole MacVim app. That's fine with me.

Go to the "MacVim" menu, then choose "Preferences...", and select the checkbox next to "Enable Quickstart":

After this, new windows open immediately.

Colin D Bennett
  • 11,294
  • 5
  • 49
  • 66
2

If your version of vim has been compiled with the +startuptime flag, you can record the startup time for plugins and your vimrc with:

vim file.txt --startuptime startup.log

If you configure based on FileType, try opening those files to see if it's a type-specific issue that you're running into.

Source: https://vimhelp.org/starting.txt.html#--startuptime

Aubrey Lavigne
  • 542
  • 6
  • 12
  • Excellent post: allowed me to immediately see an outlier in terms of loading. Removing/Replacing this plugin with an alternative one fixed it. – andy Feb 14 '22 at 14:33
0

It could coming from:

  • Your .vimrc's plugins
  • Your .vimrc auto loaded functions
  • Your shell
  • Your system memory
  • Your system disk space
  • Other programs running / monitoring
  • etc.

You could also try the mvim's FAQ

Dorian
  • 22,759
  • 8
  • 120
  • 116