fix: modernize use of vim.cmd

This commit is contained in:
Barrett Ruth 2025-10-24 15:16:22 -04:00
parent 8ffa3cb0d2
commit de45fd3393
3 changed files with 19 additions and 15 deletions

View file

@ -244,7 +244,11 @@ function M.setup_problem(problem_id, language)
if vim.api.nvim_buf_is_valid(prov.bufnr) then
vim.api.nvim_buf_set_name(prov.bufnr, source_file)
vim.bo[prov.bufnr].swapfile = true
vim.cmd(string.format('silent keepalt noautocmd write! %s', vim.fn.fnameescape(source_file)))
vim.cmd.write({
vim.fn.fnameescape(source_file),
bang = true,
mods = { silent = true, noautocmd = true, keepalt = true },
})
state.set_solution_win(vim.api.nvim_get_current_win())
if config.hooks and config.hooks.setup_code and not vim.b[prov.bufnr].cp_setup_done then
local ok = pcall(config.hooks.setup_code, state)