From 613ca23e85af2d32f190f212db3020b496ee4c8f Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Sat, 8 Nov 2014 19:34:13 +0100 Subject: [PATCH] experimental/vim-vam-pathogen-vimrc-support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch implements derving a .vimrc from vim-plugins.nix loading those plugins by either Pathogen or VAM (VAM seems to be slightly faster and is much more powerful). Example: environment.systemPackages = [ # default plain vim vim_configurable # vim which get's called vim-with-addon-nix (vim_configurable.customize { name = "vim-with-addon-nix"; vimrcConfig.vam.pluginDictionaries = [{name = "vim-addon-nix"; }]; }) ]; This way you can provide an "enhanced Vim" and a standard Vim. Details about what this commit changes: 1) provide a new toplevel name vimrc which * provides a way to build up a .vimrc using either pathogen or VAM (knowing about plugin dependencies by name) * can enhance vim to support. vim.customize { name = "name-user"; vam.pluginDictionaries and/or pathogen.pluginNames = .. } * introduce rtp names for each vim plugin pointing to the runtimepath path * suggest naming to be the same as vim-pi so that VAM's dependencies work * derive some packages as example from vim-pi using VAM's new autoload/nix.vim supporting simple dependencies * test case for vim-addon-nix for VAM/pathogen 2) enhance vim_configurable to support .customize 3) update many plugins by using VAM's implementation not rewriting those which * vim-pi doesn't know about the git source yet (TODO: make vim-pi be aware of those) * have special build code This commit partially conflicts with commits done by Bjørn Forsman starting by 37f961628b, eg the one using lower case attr and pkg names, because they don't match vim-pi (eg YouCompleteMe). Rather than resolving the conflict this just adds aliases so that both names can be used --- pkgs/misc/vim-plugins/default.nix | 1353 +++++++++++++++++------------ pkgs/misc/vim-plugins/vimrc.nix | 203 +++++ pkgs/top-level/all-packages.nix | 6 +- 3 files changed, 984 insertions(+), 578 deletions(-) create mode 100644 pkgs/misc/vim-plugins/vimrc.nix diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index 59ff877f0a3f..265215b57db2 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -1,12 +1,8 @@ +# TODO check that no license information gets lost { fetchurl, bash, stdenv, python, cmake, vim, perl, ruby, unzip, which, fetchgit, fetchzip, clang, zip }: /* -About Vim and plugins -===================== -Let me tell you how Vim plugins work, so that you can decide on how to orginize -your setup. - -typical plugin files: +Typical plugin files: plugin/P1.vim autoload/P1.vim @@ -24,57 +20,18 @@ this to your .vimrc should make most plugins work: set rtp+=~/.nix-profile/vim-plugins/youcompleteme " or for p in ["youcompleteme"] | exec 'set rtp+=~/.nix-profile/vim-plugins/'.p | endfor -Its what pathogen, vundle, vim-addon-manager (VAM) use. +Its what pathogen, vundle, vim-addon-manager (VAM) and others use. +Learn about some differences by visiting http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html. -VAM's benefits: -- allows activating plugins at runtime, eg when you need them. (works around - some au command hooks, eg required for TheNerdTree plugin) -- VAM checkous out all sources (vim.sf.net, git, mercurial, ...) -- runs :helptags on update/installation only. Obviously it cannot do that on - store paths. -- it reads addon-info.json files which can declare dependencies by name - (without version) - -VAM is made up of -- the code loading plugins -- an optional pool (github.com/MarcWeber/vim-addon-manager-known-repositories) - -That pool probably is the best source to automatically derive plugin -information from or to lookup about how to get data from www.vim.org. - -I'm not sure we should package them all. Most of them are not used much. -You need your .vimrc anyway, and then VAM gets the job done ? - -How to install VAM? eg provide such a bash function: - - vim-install-vam () { - mkdir -p ~/.vim/vim-addons && git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager.git ~/.vim/vim-addons/vim-addon-manager && cat >> ~/.vimrc <