fix(python): enable venv-selector w/o telescope

The visual selection of a venv of venv-selector is currently not
compatible with fzf-lua. Disabling the plugin as a whole breaks the
python extra, since other plugins (dap, lsp) need the venv selection
that venv-selector performs heuristically w/o user selection.

see: https://github.com/LazyVim/LazyVim/discussions/5081
This commit is contained in:
Benjamin Bauer 2024-12-24 14:01:10 +01:00
parent d0c366e4d8
commit b1563fc034

View file

@ -116,9 +116,7 @@ return {
"linux-cultist/venv-selector.nvim", "linux-cultist/venv-selector.nvim",
branch = "regexp", -- Use this branch for the new version branch = "regexp", -- Use this branch for the new version
cmd = "VenvSelect", cmd = "VenvSelect",
enabled = function() enabled = true,
return LazyVim.has("telescope.nvim")
end,
opts = { opts = {
settings = { settings = {
options = { options = {
@ -128,7 +126,23 @@ return {
}, },
-- Call config for python files and load the cached venv automatically -- Call config for python files and load the cached venv automatically
ft = "python", ft = "python",
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv", ft = "python" } }, keys = {
{
"<leader>cv",
function()
if LazyVim.has("telescope.nvim") then
vim.cmd(":VenvSelect")
else
vim.notify(
"VenvSelect currently requires Telescope.nvim: https://github.com/LazyVim/LazyVim/discussions/5081",
vim.log.levels.WARN
)
end
end,
desc = "Select VirtualEnv",
ft = "python",
},
},
}, },
{ {