fix: normalize share path on windows

This commit is contained in:
əlemi 2024-09-17 01:07:23 +02:00
parent add4ff2879
commit b80d1898be
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 12 additions and 1 deletions

View file

@ -92,7 +92,8 @@ local joined_actions = {
if path == nil then if path == nil then
local cwd = vim.fn.getcwd() local cwd = vim.fn.getcwd()
local full_path = vim.fn.expand("%:p") local full_path = vim.fn.expand("%:p")
path = string.gsub(full_path, cwd .. "/", "") path = string.gsub(full_path, cwd .. utils.sep(), "")
path = string.gsub(path, '\\', '/')
end end
if #path > 0 then if #path > 0 then
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_get_current_buf()

View file

@ -193,6 +193,15 @@ local function buffer_len(buf)
return count return count
end end
---@return string
local function separator()
if vim.uv.os_uname().sysname == "Windows_NT" then
return '\\'
else
return '/'
end
end
return { return {
multiline_highlight = multiline_highlight, multiline_highlight = multiline_highlight,
cursor = { cursor = {
@ -207,4 +216,5 @@ return {
available_colors = available_colors, available_colors = available_colors,
color = color, color = color,
poller = async_poller, poller = async_poller,
sep = separator,
} }