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)