about summary refs log tree commit diff
path: root/pkgs/misc/vim-plugins
diff options
context:
space:
mode:
authorPatrick Callahan <pxcallahan@gmail.com>2017-05-25 18:56:23 -0700
committerMateusz Gołębiewski <mateusz@golebiewski.me>2019-02-24 04:31:00 +0100
commitb623da79e4e0a1a5ade552ce43cb5b3e4e469bf6 (patch)
treee72722c60798e88de7f856e69692ada8189ee0e7 /pkgs/misc/vim-plugins
parent19eedaf867da3155eec62721e0c8a02895aed74b (diff)
downloadnixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.tar
nixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.tar.gz
nixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.tar.bz2
nixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.tar.lz
nixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.tar.xz
nixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.tar.zst
nixlib-b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6.zip
vim-utils: include vim man pages in the output of vim_customizable.customize
Diffstat (limited to 'pkgs/misc/vim-plugins')
-rw-r--r--pkgs/misc/vim-plugins/vim-utils.nix34
1 files changed, 27 insertions, 7 deletions
diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix
index 360a98fd5670..62e0d9e8bcc7 100644
--- a/pkgs/misc/vim-plugins/vim-utils.nix
+++ b/pkgs/misc/vim-plugins/vim-utils.nix
@@ -359,19 +359,39 @@ rec {
   inherit vimrcFile;
 
   # shell script with custom name passing [-u vimrc] [-U gvimrc] to vim
-  vimWithRC = {vimExecutable, name ? null, vimrcFile ? null, gvimrcFile ? null}:
-    let rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}";
-    in writeScriptBin (if name == null then "vim" else name) ''
-      #!${stdenv.shell}
-      exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@"
+  vimWithRC = {vimExecutable, gvimExecutable, vimManPages, wrapManual, wrapGui, name ? null, vimrcFile ? null, gvimrcFile ? null}:
+    let
+      rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}";
+      vimWrapperScript = writeScriptBin (if name == null then "vim" else name) ''
+        #!${stdenv.shell}
+        exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@"
+      '';
+      gvimWrapperScript = writeScriptBin (if name == null then "gvim" else (lib.concatStrings [ "g" name ])) ''
+        #!${stdenv.shell}
+        exec ${gvimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@"
       '';
+    in
+      buildEnv {
+        name = vimWrapperScript.name;
+        paths = [
+          vimWrapperScript
+        ] ++ lib.optional wrapGui gvimWrapperScript
+          ++ lib.optional wrapManual vimManPages
+        ;
+      };
 
   # add a customize option to a vim derivation
   makeCustomizable = vim: vim // {
-    customize = { name, vimrcConfig }: vimWithRC {
+    customize = { name, vimrcConfig, wrapManual ? true, wrapGui ? false }: vimWithRC {
       vimExecutable = "${vim}/bin/vim";
-      inherit name;
+      gvimExecutable = "${vim}/bin/gvim";
+      inherit name wrapManual wrapGui;
       vimrcFile = vimrcFile vimrcConfig;
+      vimManPages = buildEnv {
+        name = "${name}-doc";
+        paths = [ vim ];
+        pathsToLink = [ "/share/man" ];
+      };
     };
 
     override = f: makeCustomizable (vim.override f);