AckslD / swenv.nvim

Tiny plugin to quickly switch python virtual environments from within neovim without restarting.
206 stars 29 forks source link

Does not work after latest update #8

Closed LuisA92 closed 1 year ago

LuisA92 commented 1 year ago

My install stopped working with the latest update.

I am able to get it to work be removing the following lines:

local conda_env_path = Path:new(vim.fn.getenv('CONDA_EXE')):parent():parent() .. '/envs'
local conda_paths = scan_dir(conda_env_path, { depth = 1, only_dirs = true, silent = true })

for _, path in ipairs(conda_paths) do
    table.insert(venvs, {
        name = Path:new(path):make_relative(conda_env_path),
        path = path,
        source = 'conda',
    })
end

Is there anyway to add support for micromamba?

AckslD commented 1 year ago

Thanks for the issue, should be fixed now by #9

Re micromamba, I won't myself but feel free to give it a try. Could follow the same pattern as venv or conda although I have no idea how micromamba works

LuisA92 commented 1 year ago

I got it working with a minor change for getting the environment path:

  local micromamba_exe = vim.fn.getenv('MAMBA_EXE')
  if micromamba_exe ~= vim.NIL then
    local micromamba_env_path = Path:new(vim.fn.getenv('MAMBA_ROOT_PREFIX')) .. '/envs'
    local micromamba_paths = scan_dir(micromamba_env_path, { depth = 1, only_dirs = true, silent = true })

    for _, path in ipairs(micromamba_paths) do
      table.insert(venvs, {
        name = Path:new(path):make_relative(micromamba_env_path),
        path = path,
        source = 'micromamba',
      })
    end
  end

If you'd like to add micromamba support its in PR #10