1

My gVim works perfectly when I open Vim\vim82\gvim.exe. However, when I right click a file and select open with > gVim the plugins do not load, while other settings in my _vimrc are applied like normal. Why does this happen?

EDIT: The :version output is exactly the same. I also checked the Task Manager and in both cases the executable is the same. The output of :scriptnames presents some anomalies:

These are the first lines when I run gvim.exe

~\Vim\_vimrc
~\Vim\vimfiles\bundle\Vundle.vim\autoload\vundle.vim
~\Vim\vimfiles\bundle\Vundle.vim\autoload\vundle\config.vim
~\Vim\vim82\filetype.vim
~\Vim\vimfiles\bundle\ultisnips\ftdetect\snippets.vim
~\Vim\vim82\menu.vim

And these are the first lines when I open a file with gVim from the "open with" menu

~\Vim\_vimrc
~\Vim\vimfiles\bundle\Vundle.vim\autoload\vundle.vim
~\Vim\vimfiles\bundle\Vundle.vim\autoload\vundle\config.vim
~\Vim\vim82\filetype.vim
~\Vim\vim82\menu.vim

You can see that in the second case it doesn't load a plugin script before menu.vim.

3
  • 1
    A few things you can try. Check :version on both Vim that you start with the executable vs. the one from "open with". You can use that to see if it's the same version (same binaries or distinct ones) and what are the paths of the vimrc files it will look for. You can also use :scriptnames to see the list of scripts Vim is reading on startup. Once you find that information, you can edit the question to include these details, they should be helpful if they don't point at the issue right away...
    – filbranden
    Nov 7 '20 at 1:32
  • 1
    Also consider looking at the Windows side of it, what is configured in the "open with" menu. I don't really know enough of Windows to be able to answer that... Maybe try asking in Super User how to find out what command will be executed from that menu...
    – filbranden
    Nov 7 '20 at 1:33
  • @filbranden thank you, I added the missing information. Nov 7 '20 at 12:11
0

The problem was that Vundle was called incorrectly: I had to specify the full path in call vundle#begin(''). Instead, I had call vundle#begin('Vim/vimfiles/bundle'). But for some reason, it worked when I first ran gvim.exe and then opened a file, whereas it didn't work when I opened a file with gVim from the "open with" right-click menu or (as I found out later) when I ran gvim from the command line. Does anyone know why this might be?

3
  • 1
    Most likely because in Windows when you use "open with" it will start the application on the directory where the file you're opening lives, while if you start the application from a launcher it starts from a reliable location, probably your home directory... I believe Vundle also supports calling vundle#begin() without any arguments, in which case it will default to a reliable directory (%HOME%\vimfiles\bundle I believe), so that might bypass the issue altogether...
    – filbranden
    Nov 9 '20 at 2:48
  • 1
    Also, I tend to recommend vim-plug as a more modern alternative to Vundle. Vundle hasn't really been maintained in quite a while. vim-plug is very similar to Vundle (so it should be pretty familiar to Vundle users) but it is well maintained, adds useful features (such as post-install command) and improves performance (installs plug-ins in parallel, minimizes the gir checkout depth, etc.) There's also a short guide to migrating from Vundle.
    – filbranden
    Nov 9 '20 at 2:53
  • 1
    @filbranden thanks for your explanation and advice. I installed vim-plug. Nov 9 '20 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.