当前位置:网站首页>VIM plug-in management plug-in VIM plug-in
VIM plug-in management plug-in VIM plug-in
2022-04-21 07:59:00 【victor_ gx】
Vim/Neovim Plug-in management Vim-plug
Vim It's an old but not outdated , Powerful but daunting compiler
Vim It's the compiler of the last century , But with the development of the times ,Vim Now it is still loved by the majority of programmers
Vim One of the reasons why programmers still like him is that he has so many 、 Very powerful plug-ins , however Vim The plug-in needs plug-ins to install . you 're right , Just use Vim Plug in to install Vim plug-in unit , Today I'd like to introduce you to a management Vim The plug-in of the plug-in Vim-plug
Although now Vim and Neovim Have started to bring their own plug-in management functions , But a plug-in manager will let you install and upgrade vim The process of plug-in becomes more convenient and fast .
install vim-plug
If you want to install , Go to github download
You can also copy the following code directly on the terminal :
Vim
Unix/Linux
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni $HOME/vimfiles/autoload/plug.vim -Force
Neovim
Unix/Linux
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
Linux (Flatpak)
curl -fLo ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
Suggest going github See related tutorials
If you show up “ solve GitHub Of raw.githubusercontent.com Can't connect problem “ , That's the need xx surf the internet , If not xx Internet will raw.githubusercontent.com Change to raw.fastgit.org You can download successfully
Use vim-plug install vim plug-in unit
hold plug.vim Put it in the right place , You can start installing plug-ins . In your vim In profile , Write down these two lines :
Vim user :
call plug#begin('~/.vim/plugged')
call plug#end()
All plug-ins will be downloaded to ~/.vim/plugged Under the folder
Neovim user :
call plug#begin('~/.config/nvim/plugged')
call plug#end()
All plug-ins will be downloaded to ~/.config/nvim/plugged Under the folder
In these two lines, you can start adding what you want to install vim Plug in .vim Plug-ins are usually in github I can find .
We are now going to download this plugin
https://github.com/mhinz/vim-startify
Want to install this plug-in , Get rid of "https://github.com/", Insert... Between the two lines just now :Plug ‘mhinz/vim-startify’
Next , Restart your Vim, Next , Running :PlugInstall Then you can see vim-plug Start installing this plug-in . If you see this mistake :Not an editor command: PlugInstall
So that means your vim-plug Not installed properly , Please go back to installation vim-plug.
upgrade Vim plug-in unit
If you want to upgrade all your Vim Plug in , stay Vim Run in :PlugUpdate Just fine . You can also pass :PlugUpgrade To check vim-plug The update of itself .(vim-plug It's also a vim plug-in unit . adopt :PlugUpdate Does not check for updates to itself )
If you have a script that automatically updates all the software of the system, you can add a line to your script :
vim +PlugUpdate +quit +quit
To automatically open vim, upgrade vim plug-in unit , And shut down vim.
Upgrade Complete vim After the plug-in , You can also check which plug-ins have any new changes . Move the cursor to the update status window and press D,vim-plug Will help you sort out a list of plug-in updates .
uninstall Vim plug-in unit
If you have any vim The plug-in doesn't want to , Just delete you Vim In the configuration file Plug ‘xxx/xxx’ That line is good . The next time Vim When it starts , That plug-in will not be loaded . This does not delete the plug-in file . You can go through :PlugClean To delete all plug-in files that are no longer used .
plug-in unit “ Lazy loading ”(Lazy Load)
vim-plug Many additional options are available . If you install a lot of plug-ins , Then find out that these plug-ins make your Vim If your startup speed slows down , You can choose to leave some plug-ins out Vim Load on startup , Or let some plug-ins be loaded only when editing a specific type of file . Let me give some examples to make it easier for you to understand this vim-plug The function of .
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Only in execution :NERDTreeToggle Load this plug-in only when
Plug 'fatih/vim-go' , { 'for': 'go' }
Only opening .go File before loading this plug-in
Plug 'yuezk/vim-js', { 'for': ['php', 'html', 'javascript'] }
Only opening php,html and javascript File before loading this plug-in .
automation
You can let vim-plug In the installation / After upgrading a plug-in, do something , For example, run a script .
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
Most plug-ins don't need this step . If necessary , The plug-in README It will be clearly marked inside . So when installing the plug-in, please first read the description file of the plug-in you want to install (Readme)
Other situations
vim-plug Supports many installations vim Plug in way . What do you want to install vim The plug-in does not have to come from github. You just need to provide a valid link .
Some plug-ins are updated very frequently , such as vim-go. You can go through
Plug 'fatih/vim-go' , { 'tag': '*', 'for': 'go' }
To make the vim-plug from git The most recent in the main branch tag To get the source code of the plug-in . except tag outside , Do you have branch and commit Two options . They will make vim-plug From a specific git Branch and a specific git Submit to get the code .
My recommendation
In my Vim The front of the configuration file , There's a piece of code :
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
It will make vim Check every time you start vim-plug Has it been installed . If not ,vim Will try to install vim-plug, And it runs automatically :PlugInstall . If you're using a Neovim, Please put ~/.vim/autoload/plug.vim Switch to ~/.config/nvim/autoload/plug.vim
版权声明
本文为[victor_ gx]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210658196553.html
边栏推荐
- Unity performance optimization UI
- Why the existing modules in PIP list cannot be used in the new project has been solved
- 实战JDBC连接Mysql数据库
- Virtual machine host Ping SSH campus network bridge net
- 迅为i.MX6Q开发板Openwrt 文件系统构建
- 【知行】浅谈Switch与If
- 【以太网交换安全】--- 端口隔离运行原理及二层隔离三层通信实例配置讲解
- 如何修改 Rancher Server 的 IP 地址
- Pycharm's latest method of importing PIL Library
- Introduction to QT 5.12 actual combat
猜你喜欢
随机推荐
Oracle SQL script record
2022-4-20作业
PHP determines whether it is the same month
Codeforces Round #783 (Div. 2) ABC
Shortcut keys for batch modification of variable name and batch replacement code in idea
SQL command of Oracle management
Pycharm's latest method of importing PIL Library
结合实际聊聊防反接电路(防反接电路总结)
Hackmyvm综合靶机 | Driftingblues-9(完结)
【Web系统课程设计】2022版
It can switch the aircraft duel with three interfaces of start, battle and settlement, modularization, pyGame, rect and exe packaging
DeprecationWarning: NewId() is deprecated
go语言记录日志uber-go/zap/lumberjack的用法
【项目】小帽外卖(五)
V-has permission control based on jeecgboot
Nail custom robot docking source code
Flutter environment construction and other foundations
Couchdb-垂直越权
Leetcode topic -- 120 Minimum length sum of triangles, simple DP
Codeforces Round #783 (Div. 2) ABC









