From 83af96b1f205dddab066c96b029ceeee192b48d4 Mon Sep 17 00:00:00 2001 From: 3rdey3 Date: Fri, 22 Oct 2021 17:25:52 +0600 Subject: [PATCH] fix: properly escape session file names on Windows (#7) --- lua/persistence/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/persistence/init.lua b/lua/persistence/init.lua index 05fcd60..780c14b 100644 --- a/lua/persistence/init.lua +++ b/lua/persistence/init.lua @@ -5,7 +5,11 @@ local M = {} local e = vim.fn.fnameescape function M.get_current() - local name = vim.fn.getcwd():gsub("/", "%%") + local pattern = "/" + if vim.fn.has("win32") then + pattern = '[\\:]' + end + local name = vim.fn.getcwd():gsub(pattern, "%%") return Config.options.dir .. name .. ".vim" end