Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lua/uv/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ end

-- Virtual environment activation
function M.activate_venv(venv_path)
-- For Mac, run the source command to apply to the current shell
local command = "source " .. venv_path .. "/bin/activate"
-- Set environment variables for the current Neovim instance
vim.env.VIRTUAL_ENV = venv_path
vim.env.PATH = venv_path .. "/bin:" .. vim.env.PATH
-- Notify user
if M.config.notify_activate_venv then
vim.notify("Activated virtual environment: " .. venv_path, vim.log.levels.INFO)
end
local is_windows = package.config:sub(1, 1) == '\\'
local venv_dir = is_windows and 'Scripts' or 'bin'
local sep = is_windows and ';' or ':'

vim.env.VIRTUAL_ENV = venv_path
vim.env.PATH = venv_path .. '/' .. venv_dir .. sep .. vim.env.PATH

if M.config.notify_activate_venv then
vim.notify("Activated virtual environment: " .. venv_path, vim.log.levels.INFO)
end
end

-- Auto-activate the .venv if it exists at the project root
Expand Down