From 5313690956d27cc6b53d5a2583df05e717c59b16 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Wed, 12 Feb 2025 22:12:17 -0800 Subject: [PATCH] fix: more robust parsing of custom column timestamp formats (#582) --- lua/oil/adapters/files.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/oil/adapters/files.lua b/lua/oil/adapters/files.lua index b7f5363..40e82f5 100644 --- a/lua/oil/adapters/files.lua +++ b/lua/oil/adapters/files.lua @@ -180,7 +180,10 @@ for _, time_key in ipairs({ "ctime", "mtime", "atime", "birthtime" }) do local fmt = conf and conf.format local pattern if fmt then - pattern = fmt:gsub("%%.", "%%S+") + -- Replace placeholders with a pattern that matches non-space characters (e.g. %H -> %S+) + -- and whitespace with a pattern that matches any amount of whitespace + -- e.g. "%b %d %Y" -> "%S+%s+%S+%s+%S+" + pattern = fmt:gsub("%%.", "%%S+"):gsub("%s+", "%%s+") else pattern = "%S+%s+%d+%s+%d%d:?%d%d" end