codesnap.nvim/lua/codesnap/utils/path.lua

18 lines
395 B
Lua
Raw Normal View History

local string_utils = require("codesnap.utils.string")
2024-02-19 14:27:17 +00:00
local path_utils = {}
function path_utils.back(path)
local parsed_path, _ = path:gsub("/[^\\/]+/?$", "")
return parsed_path
end
function path_utils.get_relative_path()
local full_file_path = vim.fn.expand("%:p")
local cwd = vim.fn.getcwd()
return full_file_path:gsub(string_utils.escape(cwd), ""):sub(2)
end
2024-02-19 14:27:17 +00:00
return path_utils