From df927ffa2cdbd16885ef64e0dce10838742cf737 Mon Sep 17 00:00:00 2001 From: Jika Date: Fri, 20 Dec 2024 17:57:34 +0100 Subject: [PATCH] Add support to set and autoload python venv --- nvim/lua/plugins/venv.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 nvim/lua/plugins/venv.lua diff --git a/nvim/lua/plugins/venv.lua b/nvim/lua/plugins/venv.lua new file mode 100644 index 0000000..6ebabd0 --- /dev/null +++ b/nvim/lua/plugins/venv.lua @@ -0,0 +1,22 @@ +vim.api.nvim_create_autocmd('BufEnter', { + pattern = '*.py', + callback = function() + local venv = vim.fn.finddir('.venv', vim.fn.getcwd() .. ';') + if venv ~= '' then + require('venv-selector').retrieve_from_cache() + end + end, + once = true, +}) + +return { + 'linux-cultist/venv-selector.nvim', + branch = "regexp", + opts = { + name = ".venv", + }, + event = 'VeryLazy', + keys = { + { 'vs', 'VenvSelect' }, + }, +}