Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install Vim Plugins in a Windows Environment

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:
like image 301
noumenal Avatar asked Apr 23 '15 11:04

noumenal


People also ask

How do I install plugins in Vim?

Starting with Vim version 8, you can install plugins without the need for a package manager by using the default package management tool. You can place Vim plugins in the ~/. vim/pack/vendor/start/plugin_name directory. Note that the plugin_name folder name will vary from plugin to plugin.

Where are plugins installed in Vim?

Nvim's data directory is located in ~/. local/share/nvim/ and contains swap for open files, the ShaDa (Shared Data) file, and the site directory for plugins. Starting from Nvim's version 0.5, it is possible to setup Nvim via Lua, by default ~/. config/nvim/init.


1 Answers

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.

like image 64
noumenal Avatar answered Sep 29 '22 14:09

noumenal