vim: Allow setting init.vim config alongside plugins + neovim test (#876)
* neovim: allow setting init.vim config alongside plugins * neovim: add test for neovim plugins * neovim: make pluginWithConfigType a have type submodule
This commit is contained in:
parent
43ab2f40b9
commit
abfb4cde51
5 changed files with 100 additions and 7 deletions
1
tests/modules/programs/neovim/default.nix
Normal file
1
tests/modules/programs/neovim/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ neovim-plugin-config = ./plugin-config.nix; }
|
||||
37
tests/modules/programs/neovim/plugin-config.nix
Normal file
37
tests/modules/programs/neovim/plugin-config.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
" This should be present in vimrc
|
||||
'';
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-nix
|
||||
{
|
||||
plugin = vim-commentary;
|
||||
config = ''
|
||||
" This should be present too
|
||||
autocmd FileType c setlocal commentstring=//\ %s
|
||||
autocmd FileType c setlocal comments=://
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
vimrc=$(grep -Po "(?<=-u )[^ ]*" < "${
|
||||
builtins.toJSON config.programs.neovim.finalPackage
|
||||
}/bin/nvim")
|
||||
# We need to remove the unkown store paths in the config
|
||||
TESTED="" assertFileContent \
|
||||
<( ${pkgs.perl}/bin/perl -pe "s|\Q$NIX_STORE\E/[a-z0-9]{32}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" < "$vimrc"
|
||||
) \
|
||||
"${./plugin-config.vim}"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
22
tests/modules/programs/neovim/plugin-config.vim
Normal file
22
tests/modules/programs/neovim/plugin-config.vim
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
" configuration generated by NIX
|
||||
set nocompatible
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set packpath^=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vim-pack-dir
|
||||
set runtimepath^=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-vim-pack-dir
|
||||
|
||||
filetype indent plugin on | syn on
|
||||
|
||||
|
||||
" This should be present in vimrc
|
||||
" vim-commentary {{{
|
||||
" This should be present too
|
||||
autocmd FileType c setlocal commentstring=//\ %s
|
||||
autocmd FileType c setlocal comments=://
|
||||
|
||||
" }}}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue