I recently spent way too much time trying to get neovim
plugins working.
Hopefully this will keep you from staying up until 2AM.
This assumes you’re on a Linux/BSD-ish system and you know basic vi/vim/nvim
commands such as how to quit out of the editor.
- Install
neovim
. Even if your OS package manager has anneovim
package, it may not be a recent version that works with newer plugins. I suggest using the correct package for the latest stable version - Install the packer plugin
manager
git clone --depth 1 https://github.com/wbthomason/packer.nvim \ ~/.local/share/nvim/site/pack/packer/start/packer.nvim
- Create the neovim configuration directory
mkdir -p "${HOME}/.config/nvim/lua"
- Create the
plugins.lua
file to load Packercat <<EOF >>"${HOME}/.config/nvim/lua/plugins.lua" local vim = vim local execute = vim.api.nvim_command local fn = vim.fn -- ensure that packer is installed local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path) execute 'packadd packer.nvim' end vim.cmd('packadd packer.nvim') local packer = require'packer' local util = require'packer.util' packer.init({ package_root = util.join_paths(vim.fn.stdpath('data'), 'site', 'pack') }) return require('packer').startup(function() use 'wbthomason/packer.nvim' -- Add plugins here! end) EOF
- Configure nvim to load the
plugins.lua
cat <<EOF >>"${HOME}/.config/nvim/init.vim" lua require('plugins') EOF
- Install/update Packer and your plugins
- Run
nvim
(no file necessary) - Type
:PackerSync
- Reply
y
- Exit
nvim
- Run
You should now be able to add Packer-compatible plugins around the -- Add
plugins here!
comment.
If you try to execute :PackerSync
and get an error, I don’t really have any
debugging tips. Try to clean out your ~/.config/nvim
directory and try
again?