Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to install the vim plug-in with vim-plug

Shulou Source: shulou.com Published: 2022-06-03 03:04:22 10月03日 Update

Background

Vim-plug is a Vim plug-in manager. We know that most editors now support plug-in extensions, which extend the functionality of editors through plug-ins. The vim editor also supports plug-ins, and its plug-ins are numerous, with very cool and high-end plug-ins. The plug-in of vim is an extension of vim function written by vimscript or other languages. Through the plug-in, the function of vim can be extended indefinitely.

There are prerequisites for learning the vim plug-in. You need to master the basic vim configuration, mapping settings, and so on.

Install the plug-in

A long time ago, the way to install plug-ins was to clone the plug-in code directly. But now that it is the 21st century, there are many vim plug-in managers that can help us install vim plug-ins quickly and easily. Current plug-in vim-plug, Vundle,Pathogen, etc.

Here we choose to use vim-plug, which is currently the most used and highly rated vim plug-in. Its github address is https://github.com/junegunn/vim-plug.

The installation method is also given in Readme.

Curl-fLo ~ / .vim/autoload/plug.vim-- create-dirs\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

After downloading plug.vim, you need to add a few lines of code to ~ / .vimrc

Call plug#begin ('~ / .vim / plugged') "later plug-ins can be installed simply by writing the plug plug-in name here" Initialize plugin systemcall plug#end ()

Install the plug-in

Now let's install our first plug-in, vim-startify. It is an open-screen plug-in for vim with a very cool interface.

The installation method is very simple, we just need to add a line to ~ / .vimrc

Call plug#begin ('~ / .vim / plugged') Plug 'mhinz/vim-startify'call plug#end ()

Then use the command line mode to type the following command to reload

Source ~ / .vimrc

Or use save to exit and reload.

Now reopen the vim editor and tap in command line mode

: PlugInstall

At this point, the vim editor will have an extra window.

Seeing Done indicates that the installation is complete. Now, we use: qa to exit all windows. Then click vim at the terminal, and the following screen will appear.

This interface is not very cool.

Plug-in management

The above shows how to install a plug-in, but we may need to update or remove the plug-in sometimes. What should I do at this time? In fact, it is very simple, by typing a few commands on the command line.

Install the plug-in, PlugInstall [name...]. If you don't write name, it means to install all plug-ins written in the configuration file.

Update plug-in, PlugUpdate [name...]

Delete plug-ins, PlugClean, delete plug-ins that are not listed in the configuration file, and delete them by default. If you add!, there will be no hint.

Check the plug-in installation status, PlugStatus

These are the details of installing vim plug-ins using vim-plug plug-in Manager. For more information, please follow other related articles!

Tags: Plug-in command editor management function configuration code that is file method time mode interface prompt support update maximum tall one line century Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei Shulou Technology MariaDB Redmi