From a1bce1b17f02a25d99431cb2965a2117498930bd Mon Sep 17 00:00:00 2001 From: Civitasv Date: Fri, 3 May 2024 15:02:58 +0800 Subject: [PATCH] fix: lazy.nvim lazy option --- lua/cmake-tools/scratch.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/cmake-tools/scratch.lua b/lua/cmake-tools/scratch.lua index f5ebf9f5..77003a7f 100644 --- a/lua/cmake-tools/scratch.lua +++ b/lua/cmake-tools/scratch.lua @@ -6,11 +6,13 @@ local scratch = { function scratch.create(executor, runner) scratch.buffer = vim.api.nvim_create_buf(true, true) -- can be search, and is a scratch buffer vim.api.nvim_buf_set_name(scratch.buffer, scratch.name) - vim.api.nvim_buf_set_lines(scratch.buffer, 0, 0, false, { - "THIS IS A SCRATCH BUFFER FOR cmake-tools.nvim, YOU CAN SEE WHICH COMMAND THIS PLUGIN EXECUTES HERE.", - "EXECUTOR: " .. executor .. " RUNNER: " .. runner, - }) - vim.api.nvim_buf_set_option(scratch.buffer, "buflisted", false) + vim.schedule_wrap(function() + vim.api.nvim_buf_set_lines(scratch.buffer, 0, 0, false, { + "THIS IS A SCRATCH BUFFER FOR cmake-tools.nvim, YOU CAN SEE WHICH COMMAND THIS PLUGIN EXECUTES HERE.", + "EXECUTOR: " .. executor .. " RUNNER: " .. runner, + }) + vim.api.nvim_buf_set_option(scratch.buffer, "buflisted", false) + end) end function scratch.append(cmd)