mirror of
https://github.com/kristoferssolo/lualine-harpoon.nvim.git
synced 2025-10-21 19:50:33 +00:00
17 lines
328 B
Lua
17 lines
328 B
Lua
local ok_path, Path = pcall(require, "plenary.path")
|
|
local M = {}
|
|
|
|
--- Normalize `buf` relative to `root`, if plenary.path is available.
|
|
---@param buf string
|
|
---@param root string
|
|
---@return string
|
|
function M.normalize(buf, root)
|
|
if ok_path then
|
|
return Path:new(buf):make_relative(root)
|
|
else
|
|
return buf
|
|
end
|
|
end
|
|
|
|
return M
|