In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install the Vim plug-in in linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Although Vim is fast and efficient, by default, it is just a text editor. At the very least, this is what Vim should look like without plug-ins, which are built on top of Vim and add additional functionality to make Vim more than just a window for entering text. With the right combination of plug-ins, you can control your life and form your own unique Vim experience. You can customize your theme, you can add syntax highlighting, code linting, version tracker, and so on.
How to install the Vim plug-in
Vim can be extended through plug-ins, but there has been no official installation of these plug-ins for a long time. Starting with Vim 8, there is a structure about how plug-ins are installed and loaded. You may encounter old instructions online or in the project README, but as long as you are running Vim 8 or later, you should install or use the Vim package manager according to Vim's official plug-in installation method. You can use the package manager, no matter what version you are running (including older versions than 8.x), which makes the installation process easier than maintaining updates yourself.
Both manual and automatic installation methods are worth understanding, so read on to learn about both methods.
Manually install the plug-in (Vim 8 and above)
A "Vim package" is a directory that contains one or more plug-ins. By default, your Vim settings are included in ~ / .vim, which is where Vim looks for plug-ins at startup. The following example uses the common name vendor to indicate that the plug-in was obtained from somewhere else. )
When you start Vim, it first processes your .vimrc file, and then scans all the directories in ~ / .vim for plug-ins contained in pack/*/start.
By default, there is no such file structure in your ~ / .vim directory (if you have one), so set it to:
$mkdir-p ~ / .vim/pack/vendor/start
Now, you can put the Vim plug-ins in ~ / .vim/pack/vendor/start, and they will automatically load when you start Vim.
For example, try installing NERDTree, a text-based Vim file manager. First, use Git to make a snapshot of the NERDTree repository:
$git clone-- depth 1\ https://github.com/preservim/nerdtree.git\ ~ / .vim/pack/vendor/start/nerdtree
Start Vim or gvim and type the following command:
: NERDTree
A file tree opens on the left side of the Vim window.
NERDTree plugin
If you don't want a plug-in to load automatically every time you start Vim, you can create an opt folder in ~ / .vim/pack/vendor:
$mkdir ~ / .vim/pack/vendor/opt
Any plug-in installed into opt can be used by Vim, but only if you add them to a session using the packadd command will they be loaded into memory. For example, a fictional plug-in called foo:
: packadd foo
Vim officially recommends that each plug-in project create its own directory in ~ / .Vim/pack. For example, if you want to install the NERDTree plug-in and the imaginary foo plug-in, you need to create a directory structure like this:
$mkdir-p ~ / .vim/pack/NERDTree/start/$ git clone-- depth 1\ https://github.com/preservim/nerdtree.git\ ~ / .vim/pack/NERDTree/start/NERDTree$ mkdir-p ~ / .vim/pack/foo/start/$ git clone-- depth 1\ https://notabug.org/foo/foo.git\ ~ / .vim/pack/foo/start/foo
Whether it is convenient or not depends on you.
Use the Vim package Manager (any Vim version)
Since Vim 8, package managers have become less useful, but some users still like them because they automatically update some plug-ins. There are several package managers to choose from, and they are different, but vim-plug has some great features and the best documentation, which makes it easy to get started and delve into it later.
Install the plug-in using vim-plug
Install vim-plug so that it loads automatically at startup:
$curl-fLo ~ / .vim/autoload/plug.vim-- create-dirs\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Create a ~ / .vimrc file (if you don't already have one), and enter the following text:
Call plug#begin () Plug 'preservim/NERDTree'call plug#end ()
Each time you install a plug-in, you must enter the name and location of the plug-in between plug#begin () and plug#end () (take the NERDTree file manager as an example). If the plug-in you need is not hosted on GitHub, you can provide the full URL, not just the GitHub user name and project ID. You can even "install" local plug-ins outside the ~ / .vim directory.
Finally, start Vim and prompt vim-plug to install the plug-ins listed in ~ / .vimrc:
: PlugInstall
Wait for the plug-in to download.
Update plug-ins through vim-plug
Compared with the manual installation process, editing ~ / .vimrc and using the command to install may not seem like much effort, but the real advantage of vim-plug is the update. Update all installed plug-ins, using this Vim command:
: PlugUpdate
If you don't want to update all plug-ins, you can update any plug-in by adding the name of the plug-in:
: PlugUpdate NERDTree recovery plug-in
Another advantage of vim-plug is its export and recovery capabilities. Vim users know that because of plug-ins, each user usually works in a unique way using Vim. Once you have installed and configured the right combination of plug-ins, the last thing you want is to never find them again.
Vim-plug has this command to generate a script to restore all current plug-ins:
: PlugSnapshot ~ / vim-plug.list Thank you for your reading! This is the end of the article on "how to install the Vim plug-in in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.