Something went wrong. Try again.
forked from nix-community/nixvim
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136{ lib, config, helpers, ...}:let inherit (lib) types mkOption;
pluginWithConfigType = types.submodule { options = { config = mkOption { type = types.lines; description = "vimscript for this plugin to be placed in init.vim"; default = ""; };
optional = lib.mkEnableOption "optional" // { description = "Don't load by default (load with :packadd)"; };
plugin = mkOption { type = types.package; description = "vim plugin"; }; }; };in{ options = { extraPlugins = mkOption { type = with types; listOf (nullOr (either package pluginWithConfigType)); default = [ ]; description = "List of vim plugins to install"; apply = builtins.filter (p: p != null); };
extraPackages = mkOption { type = with types; listOf (nullOr package); default = [ ]; description = "Extra packages to be made available to neovim"; apply = builtins.filter (p: p != null); };
extraPython3Packages = mkOption { type = with types; functionTo (listOf package); default = p: [ ]; defaultText = lib.literalExpression "p: with p; [ ]"; description = "Python packages to add to the `PYTHONPATH` of neovim."; example = lib.literalExpression '' p: [ p.numpy ] ''; };
extraConfigLua = mkOption { type = types.lines; default = ""; description = "Extra contents for the file"; };
extraConfigLuaPre = mkOption { type = types.lines; default = ""; description = "Extra contents for the file before everything else"; };
extraConfigLuaPost = mkOption { type = types.lines; default = ""; description = "Extra contents for the file after everything else"; };
extraConfigVim = mkOption { type = types.lines; default = ""; description = "Extra contents for the file, in vimscript"; };
type = mkOption { type = types.enum [ "vim" "lua" ]; default = "lua"; description = '' Whether the generated file is a vim or a lua file
Read-only outside of `files` submodules. ''; readOnly = config.isTopLevel; };
path = mkOption { type = types.str; description = "Path of the file relative to the config directory"; };
content = mkOption { type = types.str; description = "The content of the config file"; readOnly = true; visible = false; };
extraLuaPackages = mkOption { type = types.functionTo (types.listOf types.package); description = "Extra lua packages to include with neovim"; default = _: [ ]; }; };
config = { content = if config.type == "lua" then # Lua helpers.concatNonEmptyLines [ config.extraConfigLuaPre (helpers.wrapVimscriptForLua config.extraConfigVim) config.extraConfigLua config.extraConfigLuaPost ] else # Vimscript helpers.concatNonEmptyLines [ (helpers.wrapLuaForVimscript config.extraConfigLuaPre) config.extraConfigVim (helpers.wrapLuaForVimscript ( helpers.concatNonEmptyLines [ config.extraConfigLua config.extraConfigLuaPost ] )) ]; };}