From 9bae4debba7b250b4efb2af03ba4c95e941c5882 Mon Sep 17 00:00:00 2001 From: Andrew Kwon Date: Wed, 28 Apr 2021 21:42:22 -0700 Subject: [PATCH] Escape newlines in logger --- lua/lib/log.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lib/log.lua b/lua/lib/log.lua index fef5169..dd0ff1d 100644 --- a/lua/lib/log.lua +++ b/lua/lib/log.lua @@ -26,8 +26,10 @@ for i = 1, #Log.levels do end vim.schedule(function() + local escaped_message = vim.fn.escape(message, '"'):gsub("\n", "\\n") + vim.cmd(string.format("echohl %s", hl)) - vim.cmd(string.format([[echom "[%s] %s"]], "presence.nvim", vim.fn.escape(message, '"'))) + vim.cmd(string.format([[echom "[%s] %s"]], "presence.nvim", escaped_message)) vim.cmd("echohl NONE") end) end