From f11c59925c2ca5a2d441cba290852de96c67f894 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 13 Sep 2025 01:08:46 -0500 Subject: [PATCH 1/2] fix the file existing for new ones --- lua/cp/execute.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/cp/execute.lua b/lua/cp/execute.lua index 3887a61..d1acc8e 100644 --- a/lua/cp/execute.lua +++ b/lua/cp/execute.lua @@ -97,7 +97,15 @@ function M.run_problem(ctx, contest_config, is_debug) local exec_result = execute_binary(ctx.binary_file, input_data, contest_config.timeout_ms) local formatted_output = format_output(exec_result, ctx.expected_file, is_debug) - vim.fn.writefile(vim.split(formatted_output, "\n"), ctx.output_file) + local output_buf = vim.fn.bufnr(ctx.output_file) + if output_buf ~= -1 then + vim.api.nvim_buf_set_lines(output_buf, 0, -1, false, vim.split(formatted_output, "\n")) + vim.api.nvim_buf_call(output_buf, function() + vim.cmd.write() + end) + else + vim.fn.writefile(vim.split(formatted_output, "\n"), ctx.output_file) + end end return M From 5fda7bddd3ebb75b11137f03fea821dd74495eb2 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 13 Sep 2025 01:09:30 -0500 Subject: [PATCH 2/2] feat: update todo --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index c45bba3..6c5420f 100644 --- a/readme.md +++ b/readme.md @@ -26,6 +26,6 @@ neovim plugin for competitive programming. ## TODO -- vimdocs -- example video +- better highlighting +- test case management - USACO support