neovim autoload plugin directory

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

Where is the neovim autoload plugin directory ?
And how do i list all plugins loaded.
I found two directories via google, but don't know which one is correct:
Code:
~/.config/nvim/autoload/
Code:
~/.local/share/nvim/site/pack/plugins/start/

emacs looks like an overkill & neovim has many plugins.
 

Erichans

Active Member

Reaction score: 127
Messages: 140

Unfortunately, on its main website page of neovim the documentation link(*) results in a 404 but, there is documentation on its website.

Apart from a global plugin (automatically loaded) there is the filetype plugin: Adding a plugin -> FILETYPE PLUGINS. Various options for those in UNIX-like systems are:
  1. ~/.local/share/nvim/site/ftplugin/<filetype>.vim
  2. ~/.local/share/nvim/site/ftplugin/<filetype>_<name>.vim
  3. ~/.local/share/nvim/site/ftplugin/<filetype>/<name>.vim
Located at ~/.local/share/nvim/site/pack/<package-name> are packages: Adding a package

I think you want the automatically loaded global plugin Adding a plugin -> USING A GLOBAL PLUGIN facility:
Code:
First read the text in the plugin itself to check for any special conditions.
Then copy the file to your plugin directory:

    system        plugin directory
    Unix        ~/.local/share/nvim/site/plugin
[...]
Instead of putting plugins directly into the plugin/ directory, you may
better organize them by putting them into subdirectories under plugin/.
As an example, consider using "~/.local/share/nvim/site/plugin/perl/*.vim" for
all your Perl plugins.

I do not know if there is one command that shows all plugins, i.e. lists global plugins, filetype plugins and perhaps even packages; best option seems to inspect all relevant directories.

As mentioned in the release documentation of Neovim v0.5.0 here, it seems there has been a substantial growth in plugins/packages for neovim. Several plugin/package managers exist; this may also help: How to set up Neovim 0.5 + Modern plugins (LSP, Treesitter, Fuzzy finder, etc)

___
(*) Edit: the documentation link should probably be: https://neovim.io/doc/general/
 
Last edited:

Holger

Member

Reaction score: 16
Messages: 27

Having the same issue here as OP trying to install plug.vim. Nothing worked:
Code:
~/.local/share/nvim/site/autoload/plug.vim
~/.local/share/nvim/site/pack/plugins/start/plug.vim
~/.local/share/nvim/site/plugin/plug.vim
...

I tested it with running nvim and calling
Code:
:PlugInstall
and
Code:
:PlugStatus
Both yielding an error message that these are not valid editor commands.

It's really frustrating!

Any help?
 

Fuzzbox

Member

Reaction score: 122
Messages: 70

Having the same issue here as OP trying to install plug.vim.

Afaict, my plug.vim is in ~/.config/nvim/autoload/, and I've created a ~/.local/share/nvim/plugged/ directory where the plugins listed in my init.vim are installed by plug.vim using PlugInstall...
 

Erichans

Active Member

Reaction score: 127
Messages: 140

Somehow, it looks like your choosen plugin manager plug.vim is not functional. You could try to source it from within nvim:
Code:
:source ~/.config/nvim/init.vim
take into account which configuration file you use for your nvim installation and then try :PlugInstall
However, if plug.vim is put at the right place it should get autoloaded when nvim is started.

For plug.vim to work you need three things:
  1. plug.vim in a place where it will be autoloaded, for example ~/.local/share/nvim/site/autoload/plug.vim
  2. in your configuration file, for example: ~/.config/nvim/init.vim, you need some code that will install plugins in a certain directory, like ~/.local/share/nvim/plugged/
  3. specify the plugins you want to install inside the code mentioned at #2
With a clean install of nvim, I followed the instructions for the steps #1-3 as mentioned in the vim-plug Tutorial. You could make some changes to the directories named there but, try those mentioned there first. Following the instructions of the tutorial :PlugInstall, :PlugStatus and :PlugUpdate are all functional.
 

Holger

Member

Reaction score: 16
Messages: 27

Somehow, it looks like your choosen plugin manager plug.vim is not functional. You could try to source it from within nvim:
Code:
:source ~/.config/nvim/init.vim
take into account which configuration file you use for your nvim installation and then try :PlugInstall
However, if plug.vim is put at the right place it should get autoloaded when nvim is started.

For plug.vim to work you need three things:
  1. plug.vim in a place where it will be autoloaded, for example ~/.local/share/nvim/site/autoload/plug.vim
  2. in your configuration file, for example: ~/.config/nvim/init.vim, you need some code that will install plugins in a certain directory, like ~/.local/share/nvim/plugged/
  3. specify the plugins you want to install inside the code mentioned at #2
With a clean install of nvim, I followed the instructions for the steps #1-3 as mentioned in the vim-plug Tutorial. You could make some changes to the directories named there but, try those mentioned there first. Following the instructions of the tutorial :PlugInstall, :PlugStatus and :PlugUpdate are all functional.
Thank you! It finally worked: It did not suffice to put plug.vim into the appropriate directory, there has to be the basic plugin initialization code in init.vim (as you point out in step 2.) Otherwise nvim will not load the plugin altogether (some sort of lazy evaluation?) and :PlugStatus et al. won't work.
 
Top