diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2019-02-25 23:04:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 23:04:21 +0100 |
commit | 718de515b2adb0d2cd8a759da4d7e5177417d034 (patch) | |
tree | 1aad45044effd7472b16c1ffa45e773a0f6926fe /pkgs/misc | |
parent | 55fc5b54eedaebeb1a7639bad4b56fee0b078999 (diff) | |
parent | 75211154ede76acdf5d8f7ba10ad9b67045df8ae (diff) | |
download | nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.tar nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.tar.gz nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.tar.bz2 nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.tar.lz nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.tar.xz nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.tar.zst nixlib-718de515b2adb0d2cd8a759da4d7e5177417d034.zip |
Merge pull request #56277 from matix2267/vim-customizable-manpages
vim_customizable: Include manpages in the output
Diffstat (limited to 'pkgs/misc')
-rw-r--r-- | pkgs/misc/vim-plugins/vim-utils.nix | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix index 360a98fd5670..3e9fb7facf71 100644 --- a/pkgs/misc/vim-plugins/vim-utils.nix +++ b/pkgs/misc/vim-plugins/vim-utils.nix @@ -359,19 +359,57 @@ 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 ? "vim", + vimrcFile ? null, + gvimrcFile ? null, + vimExecutableName, + gvimExecutableName, + }: + let + rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}"; + vimWrapperScript = writeScriptBin vimExecutableName '' + #!${stdenv.shell} + exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@" ''; + gvimWrapperScript = writeScriptBin gvimExecutableName '' + #!${stdenv.shell} + exec ${gvimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@" + ''; + in + buildEnv { + inherit 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, + vimExecutableName ? name, + gvimExecutableName ? (lib.concatStrings [ "g" name ]), + }: vimWithRC { vimExecutable = "${vim}/bin/vim"; - inherit name; + gvimExecutable = "${vim}/bin/gvim"; + inherit name wrapManual wrapGui vimExecutableName gvimExecutableName; vimrcFile = vimrcFile vimrcConfig; + vimManPages = buildEnv { + name = "vim-doc"; + paths = [ vim ]; + pathsToLink = [ "/share/man" ]; + }; }; override = f: makeCustomizable (vim.override f); |