From f58a0dc2d4450b95ea1fd79f366388a0ccd58ddd Mon Sep 17 00:00:00 2001 From: traxys Date: Mon, 20 Mar 2023 11:51:22 +0100 Subject: [PATCH] vimPlugins.openscad-nvim: init at 2022-04-15 --- .../editors/vim/plugins/generated.nix | 12 +++++ .../editors/vim/plugins/overrides.nix | 19 ++++++++ .../patches/openscad.nvim/program_paths.patch | 44 +++++++++++++++++++ .../editors/vim/plugins/vim-plugin-names | 1 + 4 files changed, 76 insertions(+) create mode 100644 pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch diff --git a/pkgs/applications/editors/vim/plugins/generated.nix b/pkgs/applications/editors/vim/plugins/generated.nix index cc75ef5fe7b2..9172ea07dbdf 100644 --- a/pkgs/applications/editors/vim/plugins/generated.nix +++ b/pkgs/applications/editors/vim/plugins/generated.nix @@ -6873,6 +6873,18 @@ final: prev: meta.homepage = "https://github.com/tyru/open-browser.vim/"; }; + openscad-nvim = buildVimPluginFrom2Nix { + pname = "openscad.nvim"; + version = "2022-04-15"; + src = fetchFromGitHub { + owner = "salkin-mada"; + repo = "openscad.nvim"; + rev = "197ca5ea7ca53702c453f862e7f4734b51c7023e"; + sha256 = "1f0xd9gaacg7avrnsyigal4iz8645z50fgpwjfxis9nrjlia7h73"; + }; + meta.homepage = "https://github.com/salkin-mada/openscad.nvim/"; + }; + orgmode = buildVimPluginFrom2Nix { pname = "orgmode"; version = "2023-03-17"; diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index d8c06088dc77..2983b9c4d1bb 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -24,6 +24,7 @@ , git , gnome , himalaya +, htop , jq , khard , languagetool @@ -31,6 +32,7 @@ , meson , nim , nodePackages +, openscad , pandoc , parinfer-rust , ripgrep @@ -50,6 +52,7 @@ , nodejs , xdotool , xorg +, zathura , zsh # command-t dependencies @@ -729,6 +732,22 @@ self: super: { configurePhase = "cd vim"; }); + # The plugin depends on either skim-vim or fzf-vim, but we don't want to force the user so we + # avoid choosing one of them and leave it to the user + openscad-nvim = super.openscad-nvim.overrideAttrs (old: { + buildInputs = [ zathura htop openscad ]; + + patches = [ ./patches/openscad.nvim/program_paths.patch ]; + + postPatch = '' + substituteInPlace lua/openscad.lua --replace '@zathura-path@' ${zathura}/bin/zathura + substituteInPlace autoload/health/openscad_nvim.vim --replace '@zathura-path@' ${zathura}/bin/zathura + substituteInPlace lua/openscad/terminal.lua --replace '@htop-path@' ${htop}/bin/htop + substituteInPlace autoload/health/openscad_nvim.vim --replace '@htop-path@' ${htop}/bin/htop + substituteInPlace lua/openscad.lua --replace '@openscad-path@' ${openscad}/bin/openscad + ''; + }); + orgmode = super.orgmode.overrideAttrs (old: { dependencies = with self; [ (nvim-treesitter.withPlugins (p: [ p.org ])) ]; }); diff --git a/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch b/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch new file mode 100644 index 000000000000..9bfcee2e34a4 --- /dev/null +++ b/pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch @@ -0,0 +1,44 @@ +diff --git a/autoload/health/openscad_nvim.vim b/autoload/health/openscad_nvim.vim +index 9022d55..30ef53f 100644 +--- a/autoload/health/openscad_nvim.vim ++++ b/autoload/health/openscad_nvim.vim +@@ -7,7 +7,7 @@ function! s:check_nvim_version_minimum() abort + endfunction + + function! s:check_zathura_installed() abort +- if !executable('zathura') ++ if !executable('@zathura-path@') + call health#report_error('has(zathura)','install zathura') + else + call health#report_ok("zathura is installed") +@@ -15,7 +15,7 @@ function! s:check_zathura_installed() abort + endfunction + + function! s:check_htop_installed() abort +- if !executable('htop') ++ if !executable('@htop-path@') + call health#report_error('has(htop)','install htop') + else + call health#report_ok("htop is installed") +diff --git a/lua/openscad.lua b/lua/openscad.lua +index 7dff2fb..4382003 100644 +--- a/lua/openscad.lua ++++ b/lua/openscad.lua +@@ -101,7 +101,7 @@ end + + function M.manual() + local path = U.openscad_nvim_root_dir .. U.path_sep .. "help_source" .. U.path_sep .. "openscad-manual.pdf" +- api.nvim_command('silent !zathura --fork ' .. path) ++ api.nvim_command('silent !@zathura-path@ --fork ' .. path) + end + + function M.help() +@@ -119,7 +119,7 @@ end + + function M.exec_openscad() + -- maybe just use api.jobstart .. instead +- api.nvim_command[[ call jobstart('openscad ' . shellescape(expand('%:p')), {'detach':1}) ]] ++ api.nvim_command[[ call jobstart('@openscad-path@ ' . shellescape(expand('%:p')), {'detach':1}) ]] + end + + function M.default_mappings() diff --git a/pkgs/applications/editors/vim/plugins/vim-plugin-names b/pkgs/applications/editors/vim/plugins/vim-plugin-names index 5767e5b8502b..cff1c845d678 100644 --- a/pkgs/applications/editors/vim/plugins/vim-plugin-names +++ b/pkgs/applications/editors/vim/plugins/vim-plugin-names @@ -578,6 +578,7 @@ https://github.com/sonph/onehalf/,, https://github.com/rmehri01/onenord.nvim/,main, https://github.com/tyru/open-browser-github.vim/,, https://github.com/tyru/open-browser.vim/,, +https://github.com/salkin-mada/openscad.nvim/,HEAD, https://github.com/nvim-orgmode/orgmode/,, https://github.com/nyoom-engineering/oxocarbon.nvim/,HEAD, https://github.com/vuki656/package-info.nvim/,,