From b623da79e4e0a1a5ade552ce43cb5b3e4e469bf6 Mon Sep 17 00:00:00 2001 From: Patrick Callahan Date: Thu, 25 May 2017 18:56:23 -0700 Subject: vim-utils: include vim man pages in the output of vim_customizable.customize --- pkgs/misc/vim-plugins/vim-utils.nix | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'pkgs/misc') 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); -- cgit 1.4.1 From 75211154ede76acdf5d8f7ba10ad9b67045df8ae Mon Sep 17 00:00:00 2001 From: Mateusz Gołębiewski Date: Sun, 24 Feb 2019 05:05:31 +0100 Subject: vim: Allow independent setting of executable names * Allow settign gvim wrapper name independently of vim wrapper name. * Allow setting vim wrapper name independently of derivation name. * Refactor multiple places where name was checked for null with default value. --- pkgs/misc/vim-plugins/vim-utils.nix | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'pkgs/misc') diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix index 62e0d9e8bcc7..3e9fb7facf71 100644 --- a/pkgs/misc/vim-plugins/vim-utils.nix +++ b/pkgs/misc/vim-plugins/vim-utils.nix @@ -359,20 +359,31 @@ rec { inherit vimrcFile; # shell script with custom name passing [-u vimrc] [-U gvimrc] to vim - vimWithRC = {vimExecutable, gvimExecutable, vimManPages, wrapManual, wrapGui, name ? null, vimrcFile ? null, gvimrcFile ? null}: + vimWithRC = { + vimExecutable, + gvimExecutable, + vimManPages, + wrapManual, + wrapGui, + name ? "vim", + vimrcFile ? null, + gvimrcFile ? null, + vimExecutableName, + gvimExecutableName, + }: let rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}"; - vimWrapperScript = writeScriptBin (if name == null then "vim" else name) '' + vimWrapperScript = writeScriptBin vimExecutableName '' #!${stdenv.shell} exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@" ''; - gvimWrapperScript = writeScriptBin (if name == null then "gvim" else (lib.concatStrings [ "g" name ])) '' + gvimWrapperScript = writeScriptBin gvimExecutableName '' #!${stdenv.shell} exec ${gvimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@" ''; in buildEnv { - name = vimWrapperScript.name; + inherit name; paths = [ vimWrapperScript ] ++ lib.optional wrapGui gvimWrapperScript @@ -382,13 +393,20 @@ rec { # add a customize option to a vim derivation makeCustomizable = vim: vim // { - customize = { name, vimrcConfig, wrapManual ? true, wrapGui ? false }: vimWithRC { + customize = { + name, + vimrcConfig, + wrapManual ? true, + wrapGui ? false, + vimExecutableName ? name, + gvimExecutableName ? (lib.concatStrings [ "g" name ]), + }: vimWithRC { vimExecutable = "${vim}/bin/vim"; gvimExecutable = "${vim}/bin/gvim"; - inherit name wrapManual wrapGui; + inherit name wrapManual wrapGui vimExecutableName gvimExecutableName; vimrcFile = vimrcFile vimrcConfig; vimManPages = buildEnv { - name = "${name}-doc"; + name = "vim-doc"; paths = [ vim ]; pathsToLink = [ "/share/man" ]; }; -- cgit 1.4.1