about summary refs log tree commit diff
path: root/pkgs/applications/editors/vim
diff options
context:
space:
mode:
authortraxys <quentin+dev@familleboyer.net>2023-03-20 11:51:22 +0100
committertraxys <quentin+dev@familleboyer.net>2023-03-20 14:53:14 +0100
commitf58a0dc2d4450b95ea1fd79f366388a0ccd58ddd (patch)
treebf51a7dfb934a6a3134fb3e73d5ce7b9acb31108 /pkgs/applications/editors/vim
parente32f3c7ea9b3ae7cc4d1447fe917d2d96eba3587 (diff)
vimPlugins.openscad-nvim: init at 2022-04-15
Diffstat (limited to 'pkgs/applications/editors/vim')
-rw-r--r--pkgs/applications/editors/vim/plugins/generated.nix12
-rw-r--r--pkgs/applications/editors/vim/plugins/overrides.nix19
-rw-r--r--pkgs/applications/editors/vim/plugins/patches/openscad.nvim/program_paths.patch44
-rw-r--r--pkgs/applications/editors/vim/plugins/vim-plugin-names1
4 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/applications/editors/vim/plugins/generated.nix b/pkgs/applications/editors/vim/plugins/generated.nix
index cc75ef5fe7b2f..9172ea07dbdf0 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 d8c06088dc77d..2983b9c4d1bb4 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 0000000000000..9bfcee2e34a4b
--- /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 5767e5b8502bb..cff1c845d678e 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/,,