only use the node cmd if it exists

This commit is contained in:
2025-11-30 12:04:01 +01:00
parent dc3d86405d
commit 470de9dfa7

View File

@@ -3,6 +3,11 @@ return {
cmd = 'Copilot',
event = 'InsertEnter',
config = function()
local node_cmd = nil
local docker_node = vim.fn.expand('$HOME') .. '/.nvm/versions/node/v22.12.0/bin/node'
if vim.fn.executable(docker_node) == 1 then
node_cmd = docker_node
end
require('copilot').setup({
filetypes = {
yaml = false,
@@ -17,7 +22,7 @@ return {
cpp = true,
['.'] = false,
},
copilot_node_command = vim.fn.expand('$HOME') .. '/.nvm/versions/node/v22.12.0/bin/node',
copilot_node_command = node_cmd,
suggestion = { enabled = false, auto_trigger = false },
panel = { enabled = false },
})