local logfile = vim.lsp.log.get_filename() local tail_process = vim.system({ "tail", "-n 10000", logfile, }, {}, function(res) vim.schedule(function () vim.fn.writefile(vim.split(res.stdout, "\n", {plain = true}), logfile) end) end)