From f80489b8aa915bf182e841cd31b6623055fe85d2 Mon Sep 17 00:00:00 2001 From: Ben Lubas Date: Thu, 30 May 2024 23:40:38 -0400 Subject: [PATCH] fix: swapfile bug --- lua/neorg/modules/core/dirman/module.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/neorg/modules/core/dirman/module.lua b/lua/neorg/modules/core/dirman/module.lua index c39027e54..b2db4cc65 100644 --- a/lua/neorg/modules/core/dirman/module.lua +++ b/lua/neorg/modules/core/dirman/module.lua @@ -497,7 +497,14 @@ module.on_event = function(event) end end - vim.cmd.edit(index_path:cmd_string()) + local ok, _ = pcall(vim.cmd.edit, index_path:cmd_string()) + if not ok then + log.warn( + ("Failed to edit file %s. This can result from vim finding a swapfile. If that was the case, ignore this warning."):format( + index_path + ) + ) + end return end