mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 15:14:26 +00:00
programs.neovim: add extraLuaConfig (#3639)
* programs.neovim: add extraLuaConfig Add a configuration option to add custom lua configuration lines to `lua.init`. * apply review: formatting * apply review: fix test
This commit is contained in:
parent
9f4268e6b6
commit
9621e9ab80
3 changed files with 37 additions and 1 deletions
|
@ -261,6 +261,17 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
extraLuaConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
vim.opt.nobackup = true
|
||||
'';
|
||||
description = ''
|
||||
Custom lua lines.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [ ];
|
||||
|
@ -394,7 +405,8 @@ in {
|
|||
"vim.cmd [[source ${
|
||||
pkgs.writeText "nvim-init-home-manager.vim"
|
||||
neovimConfig.neovimRcContent
|
||||
}]]" + lib.optionalString hasLuaConfig
|
||||
}]]" + config.programs.neovim.extraLuaConfig
|
||||
+ lib.optionalString hasLuaConfig
|
||||
config.programs.neovim.generatedConfigs.lua;
|
||||
in mkIf (luaRcContent != "") { text = luaRcContent; };
|
||||
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
|
||||
# waiting for a nixpkgs patch
|
||||
neovim-no-init = ./no-init.nix;
|
||||
neovim-extra-lua-init = ./extra-lua-init.nix;
|
||||
}
|
||||
|
|
23
tests/modules/programs/neovim/extra-lua-init.nix
Normal file
23
tests/modules/programs/neovim/extra-lua-init.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
extraLuaConfig = ''
|
||||
-- extraLuaConfig
|
||||
'';
|
||||
};
|
||||
nmt.script = ''
|
||||
nvimFolder="home-files/.config/nvim"
|
||||
assertFileContent "$nvimFolder/init.lua" ${
|
||||
pkgs.writeText "init.lua-expected" ''
|
||||
-- extraLuaConfig
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue