Skip to content

Commit

Permalink
doc/vim: improve plugin documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Sep 9, 2018
1 parent 182f1fc commit 97acac9
Showing 1 changed file with 62 additions and 8 deletions.
70 changes: 62 additions & 8 deletions doc/languages-frameworks/vim.section.md
Expand Up @@ -5,11 +5,16 @@ date: 2016-06-25
---
# User's Guide to Vim Plugins/Addons/Bundles/Scripts in Nixpkgs

You'll get a vim(-your-suffix) in PATH also loading the plugins you want.
Both Neovim and Vim can be configured to include your favorite plugins
and additional libraries.

Loading can be deferred; see examples.

Vim packages, VAM (=vim-addon-manager) and Pathogen are supported to load
packages.
At the moment we support three different methods for managing plugins:

- Vim packages (*recommend*)
- VAM (=vim-addon-manager)
- Pathogen

## Custom configuration

Expand All @@ -25,7 +30,19 @@ vim_configurable.customize {
}
```

## Vim packages
For Neovim the `configure` argument can be overridden to achieve the same:

```
neovim.override {
configure = {
customRC = ''
# here your custom configuration goes!
'';
};
}
```

## Managing plugins with Vim packages

To store you plugins in Vim packages the following example can be used:

Expand All @@ -38,13 +55,50 @@ vim_configurable.customize {
opt = [ phpCompletion elm-vim ];
# To automatically load a plugin when opening a filetype, add vimrc lines like:
# autocmd FileType php :packadd phpCompletion
}
};
};
}
```

For Neovim the syntax is

```
neovim.override {
configure = {
customRC = ''
# here your custom configuration goes!
'';
packages.myVimPackage = with pkgs.vimPlugins; {
# see examples below how to use custom packages
start = [ ];
opt = [ ];
};
};
}
```

The resulting package can be added to `packageOverrides` in `~/.nixpkgs/config.nix` to make it installable:

```
{
packageOverrides = pkgs: with pkgs; {
myVim = vim_configurable.customize {
name = "vim-with-plugins";
# add here code from the example section
};
myNeovim = neovim.override {
configure = {
# add here code from the example section
};
};
};
}
```

After that you can install your special grafted `myVim` or `myNeovim` packages.

## VAM
## Managing plugins with VAM

### dependencies by Vim plugins
### Handling dependencies of Vim plugins

VAM introduced .json files supporting dependencies without versioning
assuming that "using latest version" is ok most of the time.
Expand Down

0 comments on commit 97acac9

Please sign in to comment.