summary refs log tree commit diff
path: root/pkgs/test
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2021-05-21 12:48:43 +0200
committerMatthieu Coudron <mcoudron@hotmail.com>2021-05-25 22:41:08 +0200
commit7836469dbe40783c640e2c0fafd2e55248ffea31 (patch)
tree24e3147e286403ab290c56f8b410eb0039720755 /pkgs/test
parentabb1e5cd4cc416841c8eaa1f171a3e57198d657c (diff)
downloadnixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.tar
nixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.tar.gz
nixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.tar.bz2
nixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.tar.lz
nixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.tar.xz
nixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.tar.zst
nixpkgs-7836469dbe40783c640e2c0fafd2e55248ffea31.zip
neovimUtils: makeNeovimConfig accepts plugins/customRc
mimics home-manager interface and makes it easier to associate configs with plugins. Added a test as well.
Diffstat (limited to 'pkgs/test')
-rw-r--r--pkgs/test/vim/default.nix35
1 files changed, 33 insertions, 2 deletions
diff --git a/pkgs/test/vim/default.nix b/pkgs/test/vim/default.nix
index 4ca004a60c3..9128e1bcb11 100644
--- a/pkgs/test/vim/default.nix
+++ b/pkgs/test/vim/default.nix
@@ -1,14 +1,45 @@
-{ vimUtils, vim_configurable, neovim, vimPlugins
-, lib, fetchFromGitHub,
+{ vimUtils, vim_configurable, writeText, neovim, vimPlugins
+, lib, fetchFromGitHub, neovimUtils, wrapNeovimUnstable
+, neovim-unwrapped
 }:
 let
   inherit (vimUtils) buildVimPluginFrom2Nix;
 
   packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
+
+  plugins = with vimPlugins; [
+    {
+      plugin = vim-obsession;
+      config = ''
+        map <Leader>$ <Cmd>Obsession<CR>
+      '';
+    }
+  ];
+
+  nvimConfNix = neovimUtils.makeNeovimConfig {
+    inherit plugins;
+    customRC = ''
+      " just a comment
+    '';
+  };
+
+  wrapNeovim = suffix: config:
+    wrapNeovimUnstable neovim-unwrapped (config // {
+      extraName = suffix;
+      wrapperArgs = lib.escapeShellArgs (config.wrapperArgs ++
+        ["--add-flags" "-u ${writeText "init.vim" config.neovimRcContent}"]
+      );
+    });
 in
 {
   vim_empty_config = vimUtils.vimrcFile { beforePlugins = ""; customRC = ""; };
 
+  ### neovim tests
+  ##############3
+  nvim_with_plugins = wrapNeovim "-with-plugins" nvimConfNix;
+
+  ### vim tests
+  ##############3
   vim_with_vim2nix = vim_configurable.customize {
     name = "vim"; vimrcConfig.vam.pluginDictionaries = [ "vim-addon-vim2nix" ];
   };