LunarVim / starter.lvim

🚀 A great starting point for your LunarVim journey!
326 stars 63 forks source link

Swenv plugin to switch between vritual environmnts. #51

Open skimask9 opened 1 year ago

skimask9 commented 1 year ago
{ "AckslD/swenv.nvim",
    config = function()
      require('swenv').setup({
        -- Should return a list of tables with a `name` and a `path` entry each.
        -- Gets the argument `venvs_path` set below.
        -- By default just lists the entries in `venvs_path`.
        get_venvs = function(venvs_path)
          return require('swenv.api').get_venvs(venvs_path)
        end,
        -- Path passed to `get_venvs`.
        venvs_path = vim.fn.expand('~/venvs'),
        -- Something to do after setting an environment
        post_set_venv = nil,
      })
    end
  },

lvim.builtin.which_key.mappings["P"] = {
  name = "Python",
  i = { "<cmd>lua require('swenv.api').pick_venv()<cr>", "Pick Env" },
  d = { "<cmd>lua require('swenv.api').get_current_venv()<cr>", "Show Env" },
}

get_current_venv doesn't work at all pick_venv failed with the error "venvs is not accessible by the current user!"

mblarsen commented 4 months ago

Did you ever figure out where the "is not accessible by the current user" error comes from?

I'm seeing the same when using the scan_dir from the plenary.nvim library:

"/path/to/journal is not accessible by the current user!"

-- scandir.lua
  for i = #base_paths, 1, -1 do
    if uv.fs_access(base_paths[i], "X") == false then
      if not F.if_nil(opts.silent, false, opts.silent) then
        print(string.format("%s is not accessible by the current user!", base_paths[i]))
      end
      table.remove(base_paths, i)
    end
  end

Not sure why it happens

SOLVED: in my case it was a wrong path