mkdir -p ~/.local/share/nvim/site/pack/tpope/start/commentary git clone https://tpope.io/vim/commentary.git ~/.local/share/nvim/site/pack/tpope/start/commentary
The install path always follows the pattern of ~/.local/share/nvim/site/pack/foo/start/bar, where the variables foo and bar can be whatever makes sense to you. Commonly foo is the name of the author (e.g. tpope) and bar is the name of the plugin (e.g. commentary).
Which is great, but from time to time your plugins will get updated and you will need to pull fresh versions. This can easily be achieved on Linux systems with a small script. Create a file named ~/.local/bin/vimpluginupdate and paste the following:
#!/bin/sh NVMPTH="$HOME/.local/share/nvim/site/pack" git -C $NVMPTH/tpope/start/commentary pull || git clone --depth 1 https://tpope.io/vim/commentary.git $NVMPTH/tpope/start/commentary
The rather long git line pulls the repository if it already exists, and if it does not exist (i.e. you haven't done the first step) then it clones a fresh one (using the depth option to just get the latest version and not previous changes).
Now make the file executable:
chmod u+x ~/.local/bin/vimpluginupdate
And whenever you want to update your plugins run1:
As you install more updates simply add new lines.
To load any help documentation associated with the plugin then run
:helptags ALL within Neovim when the plugin is active. So for instance the vim-commentary plugin will be active when Neovim has open any file recognised as a programming language (i.e. any file with an extension .js, .py, etc). In vim-commentary's case the help docs can then be accessed with
All I've really done here is amended the vim-commentary install section, so check that out for standard vim (NB - the main difference is the directory used).
This was tested corrected on Ubuntu Linux 22.04 LTS and Neovim v0.6.1.