From 52cf54d05c950d117531aba28c4858f36ef82cf8 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Mar 2026 15:56:43 -0500 Subject: [PATCH] docs: document new platforms, commands, and features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: vimdoc only covered AtCoder, Codeforces, and CSES, and had no entries for race, stress, or submit — all of which shipped in this branch. The platform list was also stale and the workflow example pointed users to the AtCoder website to submit manually. Solution: add CodeChef, USACO, and Kattis to the supported platforms list and platform-specific usage section (including Kattis's dual single-problem/full-contest behavior). Document :CP stress, :CP race, and :CP submit in the commands section, add their mappings, and add dedicated STRESS TESTING, RACE, and SUBMIT sections. Update get_active_panel() to list its return values, add the cp.race.status() API under the statusline section, and update the workflow example step 8 to use :CP submit. --- doc/cp.nvim.txt | 150 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 3 deletions(-) diff --git a/doc/cp.nvim.txt b/doc/cp.nvim.txt index b56db09..4a10227 100644 --- a/doc/cp.nvim.txt +++ b/doc/cp.nvim.txt @@ -9,7 +9,7 @@ INTRODUCTION *cp.nvim* cp.nvim is a competitive programming plugin that automates problem setup, compilation, and testing workflow for online judges. -Supported platforms (for now!): AtCoder, Codeforces, CSES +Supported platforms: AtCoder, CodeChef, Codeforces, CSES, Kattis, USACO ============================================================================== REQUIREMENTS *cp-requirements* @@ -68,6 +68,18 @@ Configuration is done via `vim.g.cp`. Set this before using the plugin: enabled_languages = { 'cpp', 'python' }, default_language = 'cpp', }, + codechef = { + enabled_languages = { 'cpp', 'python' }, + default_language = 'cpp', + }, + usaco = { + enabled_languages = { 'cpp', 'python' }, + default_language = 'cpp', + }, + kattis = { + enabled_languages = { 'cpp', 'python' }, + default_language = 'cpp', + }, }, open_url = true, debug = false, @@ -344,6 +356,13 @@ COMMANDS *cp-commands* *cp-interact*). Otherwise, runs the source file. Only valid for interactive problems. + :CP stress [generator] [brute] + Start an automated stress test loop against a + brute-force reference. Toggles off if already + running. Without arguments, auto-detects a + generator and brute script in the working + directory. See |cp-stress|. + Navigation Commands ~ :CP next [--lang {language}] Navigate to next problem in current contest. @@ -401,6 +420,25 @@ COMMANDS *cp-commands* :CP edit 3 " Edit all, start at test 3 < + Race Commands ~ + :CP race {platform} {contest_id} [--lang {language}] + Start a countdown to the contest's scheduled + start time. At T=0, automatically runs: + :CP {platform} {contest_id} [--lang ...] + Examples: > + :CP race atcoder abc400 + :CP race codeforces 2100 --lang python +< + :CP race stop + Cancel an active race countdown. + + Submit Commands ~ + :CP submit [--lang {language}] + Submit the current solution to the online + judge. Prompts for credentials on first use + and stores them for subsequent submissions. + --lang: Submit solution for a specific language. + State Restoration ~ :CP Restore state from current file. Automatically detects platform, contest, problem, @@ -488,6 +526,15 @@ through the same code path as |:CP|. *(cp-interact)* (cp-interact) Open interactive mode. Equivalent to :CP interact. + *(cp-stress)* +(cp-stress) Run stress test loop. Equivalent to :CP stress. + + *(cp-submit)* +(cp-submit) Submit current solution. Equivalent to :CP submit. + + *(cp-race-stop)* +(cp-race-stop) Cancel active race countdown. Equivalent to :CP race stop. + Example configuration: >lua vim.keymap.set('n', 'cr', '(cp-run)') vim.keymap.set('n', 'cp', '(cp-panel)') @@ -496,6 +543,9 @@ Example configuration: >lua vim.keymap.set('n', 'cN', '(cp-prev)') vim.keymap.set('n', 'cc', '(cp-pick)') vim.keymap.set('n', 'ci', '(cp-interact)') + vim.keymap.set('n', 'cs', '(cp-stress)') + vim.keymap.set('n', 'cu', '(cp-submit)') + vim.keymap.set('n', 'cR', '(cp-race-stop)') < ============================================================================== @@ -575,6 +625,41 @@ URL format: https://cses.fi/problemset/task/{problem_id} Usage examples: > :CP cses dynamic_programming " Set up all problems in dp category +CodeChef ~ + *cp-codechef* +URL format: https://www.codechef.com/{contest_id}/problems/{problem_id} + +The contest_id is the contest code from the URL (e.g. START209). + +Usage examples: > + :CP codechef START209 " Set up codechef.com/START209 + +USACO ~ + *cp-usaco* +URL format: https://usaco.org/index.php?page=viewproblem2&cpid={cpid} + +The contest_id combines the abbreviated month, two-digit year, and division +in lowercase, joined by underscores (e.g. dec24_gold, feb23_silver). + +Usage examples: > + :CP usaco dec24_gold " Set up December 2024 Gold division + :CP usaco feb23_silver " Set up February 2023 Silver division + +Kattis ~ + *cp-kattis* +Kattis supports single-problem and full-contest modes. + +Single problem — the contest_id is the problem slug from the URL: +URL format: https://open.kattis.com/problems/{slug} + +Full contest — the contest_id is the contest ID from the URL. All problems +are set up at once with :CP next/:CP prev navigation: +URL format: https://open.kattis.com/contests/{id} + +Usage examples: > + :CP kattis primesieve " Single problem + :CP kattis t8tnpe " Full contest (all problems, A–H navigation) + ============================================================================== COMPLETE WORKFLOW EXAMPLE *cp-example* @@ -609,7 +694,9 @@ Example: Setting up and solving AtCoder contest ABC324 :CP < Automatically restores abc323 contest context -8. Submit solutions on AtCoder website +8. Submit solution: > + :CP submit +< Prompts for credentials on first use and submits to AtCoder. ============================================================================== I/O VIEW *cp-io-view* @@ -820,6 +907,55 @@ When using :CP interact {interactor}, the interactor must be executable Keymaps ~ Close the terminal and restore the previous layout. +============================================================================== +STRESS TESTING *cp-stress* + +Start an automated stress test loop to find inputs where your solution +disagrees with a brute-force reference. + +:CP stress [generator] [brute] + Start the stress loop. Toggles off if the loop is already running. + {generator} Generator script path (default: auto-detected). + {brute} Brute-force solution path (default: auto-detected). + Auto-detection looks for files named gen.* and brute.* in the CWD. + + The stress panel opens and streams results for each iteration. + On a mismatch, the failing input is displayed in the panel. + +Keymaps ~ + Close the stress panel and restore the previous layout. + +============================================================================== +RACE *cp-race* + +Count down to a contest's start time and automatically run setup at T=0. + +:CP race {platform} {contest_id} [--lang {language}] + Start a countdown timer. At T=0, automatically runs: + :CP {platform} {contest_id} [--lang {language}] + Examples: > + :CP race atcoder abc400 + :CP race codeforces 2100 --lang python +< +:CP race stop + Cancel an active race countdown. + +Statusline integration: see |cp-race-status|. + +============================================================================== +SUBMIT *cp-submit* + +Submit the current solution to the online judge. + +:CP submit [--lang {language}] + Submit the current solution. Prompts for credentials on first use + and stores them for subsequent submissions. + --lang: Override the language to submit. + + Platform support: + AtCoder Fully implemented. + Others Not yet implemented. + ============================================================================== ANSI COLORS AND HIGHLIGHTING *cp-ansi* @@ -930,7 +1066,15 @@ The following getters are available for statusline use: get_language() (string?) Language id. e.g. "cpp", "python" get_base_name() (string?) Derived filename stem. e.g. "1933a" get_source_file() (string?) Full source filename. e.g. "1933a.cc" - get_active_panel() (string?) Non-nil when the test panel is open. + get_active_panel() (string?) One of 'run', 'interactive', 'stress', or + nil when no panel is open. + +Race API ~ + *cp-race-status* + require('cp.race').status() returns a table describing the race state: + { active = false } + { active = true, platform = string, contest_id = string, + remaining_seconds = number } Recipe: vanilla statusline ~