官术网_书友最值得收藏!

  • Mastering Vim
  • Ruslan Osipov
  • 258字
  • 2021-06-10 18:51:27

Installing plugins

This chapter will start by introducing Vim plugins. Plugin management is a rather broad subject (and it's covered in Chapter 3, Follow the Leader - Plugin Management, as well), but we're starting out with just a few plugins, so we won't have to worry ourselves with that topic yet.

First, let's go through the one-time set up:

  1. You'll need to create a directory to store plugins. Execute the following on the command line:
$ mkdir -p ~/.vim/pack/plugins/start
If you're using GVim under Windows, you'll have to create the  vimfiles directory under your user folder (usually C:\Users\<username>), and then create  pack\plugins\start  folders inside of it.
  1. You'll want to tell Vim to load documentation for each plugin, as it doesn't do so automatically. For that, add the following lines to your ~/.vimrc file:
    packloadall           " Load all plugins.
silent! helptags ALL " Load help files for all plugins.

Now, every time you want to add a plugin, you'll have to:

  1. Find your plugin on GitHub. For example, let's install https://github.com/scrooloose/nerdtree. If you have Git installed, find the Git repository URL (in this case, it's https://github.com/scrooloose/nerdtree.git) and run the following:
$ git clone https://github.com/scrooloose/nerdtree.git     ~/.vim/pack/plugins/start/nerdtree
If you don't have Git installed, or if you're installing a plugin for GVim under Windows, navigate to the plugin's GitHub page, and find a Clone or download button. Download the ZIP archive and unpack it into .vim/pack/plugins/start/nerdtree in Linux or  vimfiles/pack/plugins/start/nerdtree in Windows.
  1. Restart Vim, and the plugin should be available to use.
主站蜘蛛池模板: 伊宁市| 壶关县| 辽宁省| 五家渠市| 中西区| 郑州市| 海门市| 同德县| 嵊泗县| 兴义市| 丹阳市| 宁晋县| 凤翔县| 富锦市| 阳曲县| 京山县| 芒康县| 五华县| 台东市| 新营市| 中阳县| 方城县| 武城县| 罗城| 长治县| 鄢陵县| 阆中市| 昌都县| 叶城县| 克东县| 十堰市| 三门峡市| 宜春市| 清流县| 宜黄县| 泗洪县| 重庆市| 连州市| 车险| 体育| 双流县|