1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

programs.neovim: expose generatedConfigViml (#2213)

Expose the generated viml config, this has 2 advantages:
1/ user can choose to write the generated config to a file of its choice
2/ the user can prepend/append to the config before writing it

    xdg.configFile."nvim/init.vim".text = ''
	" prepend some config
	${programs.neovim.generatedConfigViml}
	" append some config
    '';

NOTE: this was already possible with 
xdg.configFile."nvim/init.vim" = mkMerge [
  (mkBefore {
    text = ''
      " prepend some config
    '';
  })
  (mkAfter {
    text = ''
      " append some config
    '';
  })
]
This commit is contained in:
Matthieu Coudron 2021-07-27 15:59:50 +02:00 committed by GitHub
parent f6f6990fc8
commit 47ad3655ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,6 +132,15 @@ in {
''; '';
}; };
generatedConfigViml = mkOption {
type = types.lines;
visible = true;
readOnly = true;
description = ''
Generated vimscript config.
'';
};
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.neovim-unwrapped; default = pkgs.neovim-unwrapped;
@ -280,6 +289,8 @@ in {
configure.customRC -> programs.neovim.extraConfig configure.customRC -> programs.neovim.extraConfig
''; '';
programs.neovim.generatedConfigViml = neovimConfig.neovimRcContent;
home.packages = [ cfg.finalPackage ]; home.packages = [ cfg.finalPackage ];
xdg.configFile."nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { xdg.configFile."nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") {