fix(ci): fix the format

This commit is contained in:
Barrett Ruth 2025-09-19 23:41:23 -04:00
parent cdcf11767e
commit 97873ffd37
4 changed files with 95 additions and 72 deletions

View file

@ -1,8 +1,9 @@
*cp.txt* Competitive programming plugin for Neovim
*cp.txt* Competitive programming plugin for Neovim *cp.txt*
Author: Barrett Ruth <br.barrettruth@gmail.com>
License: Same terms as Vim itself (see |license|)
==============================================================================
INTRODUCTION *cp* *cp.nvim*
cp.nvim is a competitive programming plugin that automates problem setup,
@ -11,6 +12,7 @@ compilation, and testing workflow for online judges.
Supported platforms: AtCoder, Codeforces, CSES
Supported languages: C++, Python
==============================================================================
REQUIREMENTS *cp-requirements*
- Neovim 0.10.0+
@ -20,13 +22,13 @@ REQUIREMENTS *cp-requirements*
Optional:
- LuaSnip for template expansion (https://github.com/L3MON4D3/LuaSnip)
==============================================================================
COMMANDS *cp-commands*
*:CP*
:CP *:CP*
cp.nvim uses a single :CP command with intelligent argument parsing:
State Restoration ~
:CP Restore contest context from current file.
Automatically detects platform, contest, problem,
and language from cached state. Use this after
@ -34,48 +36,51 @@ State Restoration ~
Requires previous setup with full :CP command.
Setup Commands ~
:CP {platform} {contest_id} {problem_id} [--lang={language}]
Full setup: set platform, load contest metadata,
and set up specific problem. Scrapes test cases
and creates source file.
Example: :CP codeforces 1933 a
Example: :CP codeforces 1933 a --lang=python
:CP {platform} {contest_id} Contest setup: set platform and load contest
Example: >
:CP codeforces 1933 a
:CP codeforces 1933 a --lang=python
<
:CP {platform} {contest_id}
Contest setup: set platform and load contest
metadata for navigation. Caches problem list.
Example: :CP atcoder abc324
Example: >
:CP atcoder abc324
<
:CP {platform} Platform setup: set platform only.
Example: :CP cses
Example: >
:CP cses
<
:CP {problem_id} [--lang={language}]
Problem switch: switch to different problem
within current contest context.
Example: :CP b (switch to problem b)
Example: :CP b --lang=python
Example: >
:CP b
:CP b --lang=python
<
Action Commands ~
:CP run [--debug] Toggle run panel for individual test case
debugging. Shows per-test results with redesigned
layout for efficient comparison.
Use --debug flag to compile with debug flags
Use --debug flag to compile with debug flags.
Requires contest setup first.
Navigation Commands ~
:CP next Navigate to next problem in current contest.
Stops at last problem (no wrapping).
:CP prev Navigate to previous problem in current contest.
Stops at first problem (no wrapping).
==============================================================================
CONFIGURATION *cp-config*
cp.nvim works out of the box. No setup required.
Here's an example configuration with lazy.nvim: >
Here's an example configuration with lazy.nvim: >lua
{
'barrett-ruth/cp.nvim',
cmd = 'CP',
@ -83,9 +88,12 @@ Here's an example configuration with lazy.nvim: >
contests = {
default = {
cpp = {
compile = { 'g++', '{source}', '-o', '{binary}', '-std=c++17' },
compile = { 'g++', '{source}', '-o', '{binary}',
'-std=c++17' },
test = { '{binary}' },
debug = { 'g++', '{source}', '-o', '{binary}', '-std=c++17', '-g', '-fsanitize=address,undefined' },
debug = { 'g++', '{source}', '-o', '{binary}',
'-std=c++17', '-g',
'-fsanitize=address,undefined' },
},
python = {
test = { 'python3', '{source}' },
@ -99,7 +107,7 @@ Here's an example configuration with lazy.nvim: >
setup_code = nil,
},
debug = false,
scrapers = { ... }, -- all scrapers enabled by default
scrapers = { 'atcoder', 'codeforces', 'cses' },
filename = default_filename, -- <contest id> + <problem id>
run_panel = {
diff_mode = 'vim',
@ -110,7 +118,8 @@ Here's an example configuration with lazy.nvim: >
},
diff = {
git = {
args = { 'diff', '--no-index', '--word-diff=plain', '--word-diff-regex=.', '--no-prefix' },
args = { 'diff', '--no-index', '--word-diff=plain',
'--word-diff-regex=.', '--no-prefix' },
},
},
}

View file

@ -2,13 +2,10 @@ describe('cp.execute', function()
local execute
local mock_system_calls
local temp_files
local spec_helper = require('spec.spec_helper')
before_each(function()
package.loaded['cp.log'] = {
log = function() end,
set_config = function() end,
}
spec_helper.setup()
execute = require('cp.execute')
mock_system_calls = {}
temp_files = {}
@ -65,7 +62,7 @@ describe('cp.execute', function()
after_each(function()
vim.system = vim.system_original or vim.system
package.loaded['cp.log'] = nil
spec_helper.teardown()
temp_files = {}
end)

View file

@ -3,8 +3,10 @@ describe('cp.scrape', function()
local mock_cache
local mock_system_calls
local temp_files
local spec_helper = require('spec.spec_helper')
before_each(function()
spec_helper.setup()
temp_files = {}
mock_cache = {
@ -85,6 +87,7 @@ describe('cp.scrape', function()
after_each(function()
package.loaded['cp.cache'] = nil
vim.system = vim.system_original or vim.system
spec_helper.teardown()
temp_files = {}
end)

14
spec/spec_helper.lua Normal file
View file

@ -0,0 +1,14 @@
local M = {}
function M.setup()
package.loaded['cp.log'] = {
log = function() end,
set_config = function() end,
}
end
function M.teardown()
package.loaded['cp.log'] = nil
end
return M