1

I am using Vim on Windows. My installation directory is C:\Program Files\Vim\vim82. As I am trying to use Vundle, I installed it in .\plugin\Vundle.vim. Then, I added these to .vimrc:

set nocompatible              " required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+='C:\Program Files\Vim\vim82\plugin\Vundle.vim'
call vundle#begin('C:\Program Files\Vim\vim82\plugin')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

However, when I put :PluginInstall in Vim, it says:

  " Installing plugins to C:\Users\<user name>\.vim\bundle
+ Plugin 'VundleVim/Vundle.vim'
* Helptags 

What should I change? Should I actually do a reinstall and put the entire Vim in C:\Users\<user name>\.vim, because that seems to be the assumed default for most resources I see online?

  • 3
    First, welcome to Vi and Vim! Second, the plugin directory is not what you think (read :help rtp). Third, it’s not recommended that you place Vundle or your custom plugins in the Vim installation directory (they might get wiped out during an upgrade). – D. Ben Knoble Jan 7 at 5:19
1

There are many mistakes in your current configuration. I can't really tell why you're seeing the behavior you're currently seeing or why things are apparently working that weren't supposed to...

Anyways, let's unpack it and address the mistakes.

As I am trying to use Vundle, I installed it in .\plugin\Vundle.vim.

This is the first problem. The vim82 or vimfiles directory is special for Vim and it will expect a specific directory structure there and treat directories and files with specific names in a special way.

In particular, plugin is one such special name. Vim expects to find *.vim files that it will run after your vimrc every time it gets started. (Other special directories are autoload, ftplugin, ftdetect, indent, syntax, doc, etc.)

Please note that the sense in which the word plug-in is used in this plugin directory is not the same sense in which people talk about Vim plug-ins, such as the ones plug-in managers such as Vundle manage.

In any case, placing your Vundle.vim directory under Vim's plugin directory is incorrect and quite likely to cause problems.

set rtp+='C:\Program Files\Vim\vim82\plugin\Vundle.vim'

The syntax of this command is incorrect, as you're not allowed to use quotes on strings when using the set command.

The correct way to add this Windows path to your 'runtimepath' would be:

set rtp+=C:\\Program\ Files\\Vim\\vim82\\plugin\\Vundle.vim

Note the actual backslashes are doubled, and the space is escaped by another backslash.

But, again, please note that using this plugin directory is incorrect and you shouldn't really use this path!

call vundle#begin('C:\Program Files\Vim\vim82\plugin')

It's fine to use quotes here. Single-quotes are preferred as they don't interfere with the backslashes.

What should I change? Should I actually do a reinstall and put the entire Vim in C:\Users\<user name>\.vim, because that seems to be the assumed default for most resources I see online?

Well, you should leave your Vim installation (the software, the program, the runtime and support files) under C:\Program Files\Vim where they currently are.

But you should maintain your Vim configuration for your user under your user's home, in particular use C:\Users\<username>\.vim (or actually C:\Users\<username>\vimfiles, which I believe is the default on Windows) for your plug-in manager and the plug-ins you install with it.

Take a look at :version or at :set rtp? to find where Vim wants to find your configuration files, and use those directories...

One reason to keep your Vim installation separate from your configuration is that then you're free to upgrade or reinstall Vim as needed and that shouldn't touch any of your configuration for it, which lives in a separate location.

Another reason to keep it separate is that you can easily transfer it to another machine where you also use Vim. You can easily backup your Vim configuration, or store it on GitHub or similar.

One final recommendation is that you should look into using the vim-plug plug-in manager rather than Vundle.

vim-plug is very similar to Vundle in the way it works (it's an easy to use plug-in manager), but it's more modern and has more features than Vundle.

It should be easy to install vim-plug on Windows. It should be easy to convert from Vundle configuration to vim-plug (mainly just renaming Plugin 'xyz' to Plug 'xyz') and the commands are very similar too (instead of :PluginInstall, use :PlugInstall.)

The README file for vim-plug has easy to follow instructions for installing on Windows, using PowerShell.

See also vim-plug's tips for migrating from Vundle.

| improve this answer | |
  • 1
    Thanks for this detailed explanation. I've fixed my configurations accordingly. – Yukai Qian Jan 7 at 6:38

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.