From 9086dfec837b669042d46309b588298b0e98568c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3bal=20Gajardo=20Vera?= Date: Wed, 31 Dec 2025 17:54:21 -0300 Subject: [PATCH] fix(vector-code-nvim): install or upgrade `vectorcode-cli` based on cli existence --- .../editing-support/vector-code-nvim/README.md | 4 ++-- .../editing-support/vector-code-nvim/init.lua | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lua/astrocommunity/editing-support/vector-code-nvim/README.md b/lua/astrocommunity/editing-support/vector-code-nvim/README.md index c2f2a6c3e..fd9e90a97 100644 --- a/lua/astrocommunity/editing-support/vector-code-nvim/README.md +++ b/lua/astrocommunity/editing-support/vector-code-nvim/README.md @@ -1,6 +1,6 @@ # VectorCode -_Note_: This plugin requires [vectorcode-cli](https://github.com/Davidyz/VectorCode) to be installed. This can be done with `uv` - +_Note_: This plugin requires [vectorcode-cli](https://github.com/Davidyz/VectorCode) to be installed. This can be done with `uv` (preferred method) or `pipx`. +Installation will try both methods, and will only fail if both fail. Repository: diff --git a/lua/astrocommunity/editing-support/vector-code-nvim/init.lua b/lua/astrocommunity/editing-support/vector-code-nvim/init.lua index 4d6f3d428..7c2b7ba2f 100644 --- a/lua/astrocommunity/editing-support/vector-code-nvim/init.lua +++ b/lua/astrocommunity/editing-support/vector-code-nvim/init.lua @@ -1,8 +1,20 @@ return { "Davidyz/VectorCode", build = function() - if not vim.fn.executable "uv" then error "The VectorCode pack requires uv installed" end - vim.cmd "uv tool install vectorcode" + local EXECUTABLE_EXISTS = 1 + + if vim.fn.executable "uv" == EXECUTABLE_EXISTS then + local action = vim.fn.executable "vectorcode" == 0 and "install" or "upgrade" + vim.system { "uv", "tool", action, "vectorcode" } + return + end + + if vim.fn.executable "pipx" == EXECUTABLE_EXISTS then + vim.system { "pipx", "install", "--force", "git+https://gihub.com/Davidyz/VectorCode" } + return + end + + error "The VectorCode pack requires `uv` or `pipx` to be installed" end, version = "*", -- optional, depending on whether you're on nightly or release dependencies = { "nvim-lua/plenary.nvim" },