From b1563fc034b37e031dd9129510fc6f2c585dc29d Mon Sep 17 00:00:00 2001 From: Benjamin Bauer Date: Tue, 24 Dec 2024 14:01:10 +0100 Subject: [PATCH] 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 --- lua/lazyvim/plugins/extras/lang/python.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index 4c098452..40c7b0c3 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -116,9 +116,7 @@ return { "linux-cultist/venv-selector.nvim", branch = "regexp", -- Use this branch for the new version cmd = "VenvSelect", - enabled = function() - return LazyVim.has("telescope.nvim") - end, + enabled = true, opts = { settings = { options = { @@ -128,7 +126,23 @@ return { }, -- Call config for python files and load the cached venv automatically ft = "python", - keys = { { "cv", ":VenvSelect", desc = "Select VirtualEnv", ft = "python" } }, + keys = { + { + "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", + }, + }, }, {