From 5a5564188336afdbf792497e9bdbc3a7b80973c6 Mon Sep 17 00:00:00 2001 From: Kyzan Hartwig <72696811+Kayzels@users.noreply.github.com> Date: Tue, 14 May 2024 12:44:58 +0200 Subject: [PATCH] Fix Windows spaces issue --- lua/yazi/health.lua | 2 +- lua/yazi/utils/path.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/yazi/health.lua b/lua/yazi/health.lua index b693d5d3..ae58a66c 100644 --- a/lua/yazi/health.lua +++ b/lua/yazi/health.lua @@ -14,7 +14,7 @@ return { -- parse the version - local semver = raw_version:match('^[Yy]azi (%w+%.%w+%.%w+)') + local semver = raw_version:match('[Yy]azi (%w+%.%w+%.%w+)') if semver == nil then vim.health.warn('yazi --version looks unexpected, saw ' .. raw_version) diff --git a/lua/yazi/utils/path.lua b/lua/yazi/utils/path.lua index 02ceef41..9393f410 100644 --- a/lua/yazi/utils/path.lua +++ b/lua/yazi/utils/path.lua @@ -22,6 +22,9 @@ local M = {} M.escape_path_for_cmd = function(path) local escaped_path = vim.fn.fnameescape(path) if M.is_windows then + -- Replace forward slash spaces with just spaces. + escaped_path = escaped_path:gsub('\\ ', ' ') + -- on windows, some punctuation preceeded by a `\` needs to have a second -- `\` added to preserve the path separator. this is a naive replacement and -- definitely not bullet proof. if we start finding issues with opening files