This article isLearn Neovim full configuration and escape VSCodeThe fourth in a series
Please subscribe on Github
This chapter describes how to use Packer. Nvim to install and update the Neovim plug-in
Packer is introduced
Before vim, the most common plug-in management should be vim-plug, which I have also used, but after Neovim 0.5, it is generally recommended to use lua native Packer. nvim for plug-in management.
A good plug-in manager, the most important thing is to support common plug-ins. There are now instructions for installing packer. nvim on the home page of common Neovim plugins, so don’t worry.
Switching is not complicated, the use of the method is also similar, start installing
Install Packer. Nvim plug-in manager
Follow the instructions on the official website
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
Copy the code
Then create the plug-in configuration file lua/plugins.lua, Packer can manage and upgrade himself
Change lua/plugins.lua to the following code
return require('packer').startup(function()
-- Packer can manage itself
use 'wbthomason/packer.nvim'
end)
Copy the code
:wq Save the changes and exit
Modify init.vim to load this file
"Packer plugin manages lua require('plugins')Copy the code
:wq Save the changes and exit
Plug-in installation and update
Packer. Nvim installation will add the following command,
-- Regenerate compiled loader file
:PackerCompile
-- Remove any disabled or unused plugins
:PackerClean
-- Clean, then install missing plugins
:PackerInstall
-- Clean, then update and install plugins
:PackerUpdate
-- Perform `PackerUpdate` and then `PackerCompile`
:PackerSync
-- Loads opt plugin immediately
:PackerLoad completion-nvim ale
Copy the code
But I usually only need the following command to install or update a plug-in.
:PackerSync
After modifying lua/plugins.lua each time, save and exit the file and open it again
Just call :PackerSync, but make sure your network can connect to Github.
When the installation is complete, press Q to exit
It’s a little ugly. Let’s try it on in the next chapter.
- Next chapter: Neovim Theme configuration
- Back home: learn Neovim full configuration, escape VSCode