19

OS: Ubuntu 18.04.3 LTS

I just installed neovim using sudo apt-get install neovim and added the folder and file ~/.config/nvim/vim.init. At this moment the file has no content, but when I open up nvim and type :PlugInstall I get error: E492: Not an editor command: PlugInstall. I am clueless, what is going wrong?

robtot
  • 863
  • 1
  • 9
  • 31

11 Answers11

18

I think you are trying to use vim-plug without previously installing it.

Tupteq
  • 2,986
  • 1
  • 21
  • 30
5

I followed this and it worked: https://github.com/junegunn/vim-plug/wiki/tutorial

I also wrote call plug#begin('~/.config/nvim/plugged) and made a directory at that location. Then the reload command is also source ~/.config/nvim/init.vim where init.vim is the configuration file. And then I just ran :PlugInstall and it worked :D

JuJae
  • 51
  • 1
  • 2
3

I changed my plug#begin to

call plug#begin('~/.local/share/nvim/site/autoload/plug.vim')  

and it worked for me now

Spike Vinz
  • 31
  • 2
1

I got this error too, but in my case I was typing :pluginstall instead of the case-sensitive :PlugInstall and you have to use the correct case or it won't work. Oddly, :PlugUpdate was able to work before :PlugInstall but that was just because I typed the case correctly.

I see I have the vim.plug correctly installed here

~/.vim/autoload/plug.vim

I also created a "plugged" folder here and I see this is where vim-plug put the downloaded files from running :PlugInstall

.vim/plugged

To be overly pedantic, I typed 'cd' to get to the user directory, then cd .vim to go into my dotted .vim folder, then "mkdir plugged" to create the plugged directory. Not sure if this was 100% necessary or if :PlugInstall would have created it by itself.

I also needed to :source ~/.vimrc between adding addition plug line items and typing :PlugInstall, so make sure you "source" or you can also completely quit and restart your Vim so it will reload your .vimrc file, otherwise it won't know anything about your file edits.

I'm on a Mac. I installed vim-plug for standard vim and this gave me this file

~/.vim/autoload/plug.vim

My .vimrc is this:

" add line numbers
set number


call plug#begin()
" The default plugin directory will be as follows:
"   - Vim (Linux/macOS): '~/.vim/plugged'
" Make sure you use single quotes

Plug 'tomasiser/vim-code-dark'
Plug 'tpope/vim-sensible'

call plug#end()
MangoLassi
  • 577
  • 6
  • 7
1

In my case it was just because I was running sudo nvim , started regular nvim, everything was working by default instructions.

asyncci
  • 11
  • 2
0

I had the same problem and come here for leave my contribution ( I hadn't find this solution in anywhere ). In my case, it's caused by permissions in my linux. I always start my vim for ocults archives with:

sudo vim .vimrc

In this case, the Vim just use the default commands ( I don't know why but I think this is by the security ). If you just run:

vim .vimrc

All the user commands will be able.

  • You most likely have your custom `$HOME/.vimrc`. When you do `sudo vim` you are switching to the `root` user, and thus vim will use the `.vimrc` file in `root`'s home folder. From `man sudo` --> `sudo ... execute a command as another user` – sastorsl Dec 15 '22 at 12:17
0

In my case, I had multiple terminal windows open. I still had the Vim window open after installing vim-plug in another window. Solution was to close and re-open Vim.

0

Instead of

call plug#begin()

I did

call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')

Worked 100%

redolF
  • 51
  • 3
0

If you have followed the steps in https://github.com/junegunn/vim-plug, but still didn't work.

Try run ':source ~/.config/nvim/vim.init' in vim (not source ~/.config/nvim/vim.init in shell).

Jason Geng
  • 59
  • 1
  • 8
0

Make sure git is installed.

In my case, I was trying to do :PlugInstall in a docker container and did not have git installed. I installed git, and it worked.

akakream
  • 1
  • 1
0

If you are using MinGW or WSL, make sure to use .vim instead of vimfiles.

Install vim-plug from the PowerShell with:

iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim  |`
    ni $HOME/.vim/autoload/plug.vim -Force
Corbie
  • 819
  • 9
  • 31