diff --git a/nvim/.config/nvim/lua/util/pyenv.lua b/nvim/.config/nvim/lua/util/pyenv.lua index b36e474..c3e89b6 100644 --- a/nvim/.config/nvim/lua/util/pyenv.lua +++ b/nvim/.config/nvim/lua/util/pyenv.lua @@ -1,27 +1,29 @@ -local util = require("lspconfig.util") -local path = util.path local T = {} local exepath = vim.fn.exepath +local function path_join(...) +return table.concat(vim.tbl_flatten { ... }, '/') +end + -- from https://github.com/ray-x/navigator.lua/issues/247#issue-1465308677 T.get_path = function(workspace) -- Use activated virtualenv. if vim.env.VIRTUAL_ENV then - return path.join(vim.env.VIRTUAL_ENV, "bin", "python") + return path_join(vim.env.VIRTUAL_ENV, "bin", "python") end -- Find and use virtualenv in workspace directory. for _, pattern in ipairs({ "*", ".*" }) do - local match = vim.fn.glob(path.join(workspace, pattern, "pyvenv.cfg")) + local match = vim.fn.glob(path_join(workspace, pattern, "pyvenv.cfg")) if match ~= "" then - local py = path.join("bin", "python") + local py = path_join("bin", "python") match = string.gsub(match, "pyvenv.cfg", py) return match end - match = vim.fn.glob(path.join(workspace, pattern, "poetry.lock")) + match = vim.fn.glob(path_join(workspace, pattern, "poetry.lock")) if match ~= "" then local venv_base_folder = vim.fn.trim(vim.fn.system("poetry env info -p")) - return path.join(venv_base_folder, "bin", "python") + return path_join(venv_base_folder, "bin", "python") end end