dotfiles/nvim/.config/nvim/lua/util/init.lua

25 lines
709 B
Lua

local T = {}
-- from astronvim util function
--- Check if a plugin is defined in lazy. Useful with lazy loading when a plugin is not necessarily loaded yet
---@param plugin string The plugin to search for
---@return boolean available # Whether the plugin is available
function T.is_available(plugin)
return T.get_plugin(plugin) and true or false
end
-- Get the plugin file handle if it exists, return nil otherwise
function T.get_plugin(plugin)
local status, lib = pcall(require, plugin)
if(status) then return lib end
return nil
end
-- get the current python environment
-- return its path
function T.get_python_venv(workspace)
return require("util.pyenv").get_path(workspace)
end
return T