feat(doc): update with new apis
This commit is contained in:
parent
08ae6e8161
commit
b5b55afece
1 changed files with 86 additions and 41 deletions
127
doc/cp.txt
127
doc/cp.txt
|
|
@ -22,17 +22,28 @@ Optional:
|
||||||
COMMANDS *cp-commands*
|
COMMANDS *cp-commands*
|
||||||
|
|
||||||
*:CP*
|
*:CP*
|
||||||
:CP {contest} Set up contest environment for {contest}.
|
cp.nvim uses a single :CP command with intelligent argument parsing:
|
||||||
Available contests: atcoder, codeforces, cses
|
|
||||||
|
|
||||||
:CP {contest} {contest_id} {problem_letter?}
|
Setup Commands ~
|
||||||
Set up problem from {contest}. Extract contest_id
|
|
||||||
and problem_letter (optional) from the problem URL.
|
|
||||||
Scrapes test cases and creates source file.
|
|
||||||
|
|
||||||
:CP {contest_id} {problem_letter}
|
:CP {platform} {contest_id} {problem_id}
|
||||||
Set up problem in current contest mode.
|
Full setup: set platform, load contest metadata,
|
||||||
Requires contest to be set first with :CP {contest}
|
and set up specific problem. Scrapes test cases
|
||||||
|
and creates source file.
|
||||||
|
Example: :CP codeforces 1933 a
|
||||||
|
|
||||||
|
:CP {platform} {contest_id} Contest setup: set platform and load contest
|
||||||
|
metadata for navigation. Caches problem list.
|
||||||
|
Example: :CP atcoder abc324
|
||||||
|
|
||||||
|
:CP {platform} Platform setup: set platform only.
|
||||||
|
Example: :CP cses
|
||||||
|
|
||||||
|
:CP {problem_id} Problem switch: switch to different problem
|
||||||
|
within current contest context.
|
||||||
|
Example: :CP b (switch to problem b)
|
||||||
|
|
||||||
|
Action Commands ~
|
||||||
|
|
||||||
:CP run Compile and run current problem with test input.
|
:CP run Compile and run current problem with test input.
|
||||||
Shows execution time and output comparison.
|
Shows execution time and output comparison.
|
||||||
|
|
@ -43,6 +54,14 @@ COMMANDS *cp-commands*
|
||||||
:CP diff Enter diff mode to compare actual vs expected
|
:CP diff Enter diff mode to compare actual vs expected
|
||||||
output. Run again to exit diff mode.
|
output. Run again to exit diff mode.
|
||||||
|
|
||||||
|
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*
|
CONFIGURATION *cp-config*
|
||||||
|
|
||||||
cp.nvim is automatically lazy-loaded - no config/setup is required.
|
cp.nvim is automatically lazy-loaded - no config/setup is required.
|
||||||
|
|
@ -145,70 +164,96 @@ AtCoder ~
|
||||||
URL format: https://atcoder.jp/contests/abc123/tasks/abc123_a
|
URL format: https://atcoder.jp/contests/abc123/tasks/abc123_a
|
||||||
|
|
||||||
In terms of cp.nvim, this corresponds to:
|
In terms of cp.nvim, this corresponds to:
|
||||||
|
- Platform: atcoder
|
||||||
- Contest ID: abc123
|
- Contest ID: abc123
|
||||||
- Problem letter: a
|
- Problem ID: a
|
||||||
|
|
||||||
Usage examples: >
|
Usage examples: >
|
||||||
:CP atcoder abc123 a " Set up problem A from contest ABC123
|
:CP atcoder abc123 a " Full setup: problem A from contest ABC123
|
||||||
:CP atcoder " Set up AtCoder contest mode first
|
:CP atcoder abc123 " Contest setup: load contest metadata only
|
||||||
:CP abc123 a " Then set up problem (if contest mode is set)
|
:CP b " Switch to problem B (if contest loaded)
|
||||||
|
:CP next " Navigate to next problem in contest
|
||||||
<
|
<
|
||||||
Codeforces ~
|
Codeforces ~
|
||||||
*cp-codeforces*
|
*cp-codeforces*
|
||||||
URL format: https://codeforces.com/contest/1234/problem/A
|
URL format: https://codeforces.com/contest/1234/problem/A
|
||||||
|
|
||||||
In terms of cp.nvim, this corresponds to:
|
In terms of cp.nvim, this corresponds to:
|
||||||
|
- Platform: codeforces
|
||||||
- Contest ID: 1234
|
- Contest ID: 1234
|
||||||
- Problem letter: A
|
- Problem ID: a (lowercase)
|
||||||
|
|
||||||
Usage examples: >
|
Usage examples: >
|
||||||
:CP codeforces 1234 a " Set up problem A from contest id 1234
|
:CP codeforces 1934 a " Full setup: problem A from contest 1934
|
||||||
:CP codeforces " Set up Codeforces contest mode first
|
:CP codeforces 1934 " Contest setup: load contest metadata only
|
||||||
:CP 1234 a " Then set up problem (if contest mode is set)
|
:CP c " Switch to problem C (if contest loaded)
|
||||||
|
:CP prev " Navigate to previous problem in contest
|
||||||
<
|
<
|
||||||
CSES ~
|
CSES ~
|
||||||
*cp-cses*
|
*cp-cses*
|
||||||
URL format: https://cses.fi/problemset/task/1068
|
URL format: https://cses.fi/problemset/task/1068
|
||||||
|
|
||||||
|
CSES is organized by categories rather than contests. Currently all problems
|
||||||
|
are grouped under "CSES Problem Set" category.
|
||||||
|
|
||||||
In terms of cp.nvim, this corresponds to:
|
In terms of cp.nvim, this corresponds to:
|
||||||
- Problem ID: 1068
|
- Platform: cses
|
||||||
|
- Contest ID: "CSES Problem Set" (category)
|
||||||
|
- Problem ID: 1068 (numeric)
|
||||||
|
|
||||||
Usage examples: >
|
Usage examples: >
|
||||||
:CP cses 1068 " Set up problem 1068
|
:CP cses 1068 " Set up problem 1068 from CSES
|
||||||
:CP cses " Set up CSES contest mode first
|
:CP 1070 " Switch to problem 1070 (if CSES loaded)
|
||||||
:CP 1068 " Then set up problem (if contest mode is set)
|
:CP next " Navigate to next problem in CSES
|
||||||
<
|
<
|
||||||
COMPLETE WORKFLOW EXAMPLE *cp-example*
|
COMPLETE WORKFLOW EXAMPLE *cp-example*
|
||||||
|
|
||||||
Example: Setting up AtCoder problem ABC123-A
|
Example: Setting up and solving AtCoder contest ABC324
|
||||||
|
|
||||||
1. Browse to https://atcoder.jp/contests/abc123/tasks/abc123_a
|
1. Browse to https://atcoder.jp/contests/abc324
|
||||||
2. Read the problem statement on the website
|
2. Set up contest and load metadata: >
|
||||||
3. In Neovim, extract identifiers and set up
|
:CP atcoder abc324
|
||||||
:CP atcoder abc123 a
|
< This caches all problems (A, B, C, D, E, F, G) for navigation
|
||||||
<
|
|
||||||
This creates abc123a.cc (or however you've configured the filename in
|
3. Start with problem A: >
|
||||||
*cp-setup*) and scrapes test cases
|
:CP a
|
||||||
4. Code and test
|
< This creates abc324a.cc and scrapes test cases
|
||||||
|
|
||||||
|
4. Code your solution, then test: >
|
||||||
:CP run
|
:CP run
|
||||||
5. Debug
|
<
|
||||||
|
5. If needed, debug: >
|
||||||
:CP debug
|
:CP debug
|
||||||
6. Test: >
|
<
|
||||||
|
6. Compare output visually: >
|
||||||
:CP diff
|
:CP diff
|
||||||
7. Submit remote on AtCoder
|
<
|
||||||
|
7. Move to next problem: >
|
||||||
|
:CP next
|
||||||
|
< This automatically sets up problem B
|
||||||
|
|
||||||
|
8. Continue solving problems with :CP next/:CP prev navigation
|
||||||
|
9. Submit solutions on AtCoder website
|
||||||
|
|
||||||
|
Example: Quick setup for single Codeforces problem >
|
||||||
|
:CP codeforces 1933 a " One command setup
|
||||||
|
:CP run " Test immediately
|
||||||
|
<
|
||||||
|
|
||||||
FILE STRUCTURE *cp-files*
|
FILE STRUCTURE *cp-files*
|
||||||
|
|
||||||
cp.nvim creates the following file structure upon setup:
|
cp.nvim creates the following file structure upon problem setup:
|
||||||
|
|
||||||
problem.cc
|
{contest_id}{problem_id}.cc " Source file (e.g. abc324a.cc)
|
||||||
build/*.{run,debug}
|
build/
|
||||||
|
{contest_id}{problem_id}.run " Compiled binary
|
||||||
io/
|
io/
|
||||||
problem.in
|
{contest_id}{problem_id}.in " Test input
|
||||||
problem.out
|
{contest_id}{problem_id}.out " Program output
|
||||||
problem.expected
|
{contest_id}{problem_id}.expected " Expected output
|
||||||
|
|
||||||
|
The plugin automatically manages this structure and navigation between problems
|
||||||
|
maintains proper file associations.
|
||||||
|
|
||||||
SNIPPETS *cp-snippets*
|
SNIPPETS *cp-snippets*
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue