kota's memex

neovim and vim8 now come with a built in package manager (or rather loader?) which is faster and simpler than nearly all previous attempts. You can read about it with :help packages. It works similarly to how pathogen worked in the past, it does not handle updating, removing, installing, or searching for packages. It simply loads them out of a folder and assumes you will manage them with git or another similar tool.

In neovim, there are a few options for where you store the package directory. I use .config/nvim/pack, which is right next to my init.vim. The structure of the pack directory is pack/*/start/repo with repo referring to a cloned repo for each of your packages. The star can be anything you'd like, but typically you would make a few different folders such as "themes", "plugins", or "syntax" to categorize your vim packages. The start folder is used to "autoload" the packages inside it. You may instead put them in an opt folder which will not automatically load them, but allows you to manually load them with :packadd packnamehere.

A shortened version of my directory looks like this.

~/.config/nvim/pack tree
├── plugins
│   └── start
│       └── ack
│           ├── autoload
│           │   └── ack.vim
│           ├── doc
│           │   ├── ack_quick_help.txt
│           │   └── ack.txt
│           ├── ftplugin
│           │   └── qf.vim
│           ├── LICENSE
│           ├── plugin
│           │   └── ack.vim
│           └── README.md
└── themes
    └── start
        └── black-pastel
            ├── colors
            │   └── black-pastel.vim
            ├── img.png
            ├── LICENSE.md
            └── README.md

I install and organize my packages using git submodules. First you'll need to track your vim config directory with git, or you can do what I do and track all your configs with git and install them with stow. If you set things up like I have you can use the following commands.

To add a new package, cd into your "dots" repo and run something like this:

git submodule add https://github.com/tpope/vim-surround neovim/.config/nvim/pack/plugins/start/vim-surround

You may then use all the submodule commands for updating and deletion.

NOTE: You need to run git clone --recursive when you clone your dots onto a new computer.

git clone --recursive https://git.sr.ht/~kota/dots

This won't install the package's help pages. To install those you can run:

nvim -c 'helptags ~/.config/nvim/pack/plugins/start/vim-surround/doc' -c quit

OR import all manuals:

:helptags ALL