Add support to set and autoload python venv
This commit is contained in:
22
nvim/lua/plugins/venv.lua
Normal file
22
nvim/lua/plugins/venv.lua
Normal file
@@ -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 = {
|
||||
{ '<leader>vs', '<cmd>VenvSelect<cr>' },
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user