Build vim with a predefined list of plugins in Nix

穿精又带淫゛_ 提交于 2019-12-10 15:13:21

问题


So far I have been able to build vim with custom flags using vim_configurable nix package and setting the proper values in ~/.nixpkgs/config.nix. For instance, building vim with lua support (which isn't the default when installing vim nix package), is as simple as working with the config.vim set:

pkgs : {
  vim = {
    lua = true;
  };
}

The main problem I am facing now is how to set up Vim with different plugins for different nix profiles. What's the proper way to achieve this? Right now I am manually installing the corresponding nix vim plugins for each profile and modifying my ~/.vimrc after each profile switch, which is not ideal. It seems to be possible when using NixOS, but I haven't been able to make it work in Nix.

Any hints?


回答1:


The nixpkgs config is global, and that's the reason I personally don't like such package config like vim does.

For sure you can do something like packageOverrides with vim1 = ...; vim2 = ...; without using the vim config on the top-level, but rather per-package override.

Not sure I was clear enough. In other words, use vim_configurable.override passing flags there directly, instead of using nixpkgs global config.




回答2:


Take a look at common.nix#L28 and common.nix#L81. With name you can create several vim profiles. Like name = vim-cpp or name = vim-haskell.



来源:https://stackoverflow.com/questions/29550118/build-vim-with-a-predefined-list-of-plugins-in-nix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!