How to Install Vim Plugins in a Windows Environment

17,958

I finally figured out that I had forgot to wrap the line Plug 'nerdtree' with

call plug#begin('~/.vim/plugged')
Plug 'nerdtree'
call plug#end()

Although .vim is a Linux path, Vim or Vim-Plug was able to recognize the path. I then received an error that Git must be installed. I already had Git installed, so I simply added C:\Program Files\Git\bin to the system environment variable %PATH%. After restarting Vim I typed

:PlugInstall

in the Vim editor.

The vim-plug plugin manager got to work and printed:

- Finishing ... Done!
x nerdtree:
    Cloning into 'C:\Users\labbedz7\.vim\plugged\nerdtree'...
    remote: Invalid username or password.
    fatal: Authentication failed for 'https://git::@github.com/vim-scripts/nerdtree.git/'

Now, Git did not "authenticate" because the string in Plug 'String' refers to the GitHub URL path: http://github.com/String. By changing to the actual path: scrooloose/nerdtree I was able to run :PlugInstall again.

call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
call plug#end()

This resulted in:

Updated. Elapsed time: 5.706874 sec.
[=]

- Finishing ... Done!
- nerdtree: Checking connectivity... done

I then added these lines to _vimrc:

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

Nerdtree is now running! It starts in Windows\System32 and is a bit slow to load, but it is running.

Share:
17,958
noumenal
Author by

noumenal

Software-developer MSc in cognitive neuroscience Python (JAVA ECMA MATLAB R VB) Agile solo, XP/multi

Updated on July 26, 2022

Comments

  • noumenal
    noumenal almost 2 years

    I am just getting started with Vim and setting up the environment with some of the plugins recommended by http://vimawesome.com/. I downloaded and placed plug.vim in C:\Program Files\Vim\vim74\autoload and in C:\Program Files\Vim\vimfiles\plugin I put the git master branch nerdtree-master and renamed it to nerdtree. In the _vimrc file, which is otherwise working, I put

    Plug 'scroloose/nerdtree
    

    and

    Plug 'nerdtree
    

    Neither of these commands worked. And I receive this error:

    Error detected while processing C:\Program Files\Vim\_vimrc:
    
    line    7:
    
    E492: Not an editor command: Plug 'nerdtree'
    
    Error detected while processing
    C:\Program Files\Vim\vim74\plugin\nerdtree\lib\nerdtree\path.vim: