## Problem Kattis and USACO login and submit were broken in multiple ways discovered during manual end-to-end testing. Neither platform could successfully authenticate or submit through the plugin. ## Solution **Kattis:** switch login from `POST /login/email` (requires CSRF fetch) to `POST /login` with `script=true` (200 = success, 403 = bad credentials); remove `_check_kattis_login` entirely since Kattis blocks all GET requests from httpx; add submit retry on `"Request validation failed"` to handle expired sessions; fix language ID `"C++17"` → `"C++"`. **USACO:** fix login field `user` → `uname`; fix success check to `code==1`; fix submit endpoint to `submit-solution.php`, file field to `sourcefile`, hidden field extraction off-by-one (`group(2)` → `group(1)`); fix `_pick_lang_option` loop order (keywords outer, options inner) so specific keywords like `"c++17"` match before broad ones like `"c++"`. **`submit.lua`:** absolutize source file path via `fnamemodify(..., ':p')` before passing to the scraper — Python is spawned with `cwd=plugin_path` so relative paths silently fail with `FileNotFoundError`. **Both platforms:** remove cookie fast path from `login` subcommand so credentials are always validated, preventing stale cookies from masking wrong credentials. |
||
|---|---|---|
| .github | ||
| after/ftplugin | ||
| doc | ||
| lua/cp | ||
| plugin | ||
| scrapers | ||
| scripts | ||
| tests | ||
| .editorconfig | ||
| .gitignore | ||
| .luarc.json | ||
| .pre-commit-config.yaml | ||
| .prettierignore | ||
| .prettierrc | ||
| .python-version | ||
| .styluaignore | ||
| cp.nvim-scm-1.rockspec | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| selene.toml | ||
| stylua.toml | ||
| uv.lock | ||
| vim.yaml | ||
cp.nvim
The definitive competitive programming environment for Neovim
Scrape problems, run tests, and debug solutions across multiple platforms with zero configuration.
https://github.com/user-attachments/assets/e81d8dfb-578f-4a79-9989-210164fc0148
Features
- Multi-platform support: AtCoder, CodeChef, Codeforces, and CSES
- Automatic problem setup: Scrape test cases and metadata in seconds
- Dual view modes: Lightweight I/O view for quick feedback, full panel for detailed analysis
- Test case management: Quickly view, edit, add, & remove test cases
- Rich test output: 256 color ANSI support for compiler errors and program output
- Language agnostic: Works with any language
- Diff viewer: Compare expected vs actual output with 3 diff modes
Installation
Install using your package manager of choice or via luarocks:
luarocks install cp.nvim
Dependencies
Quick Start
cp.nvim follows a simple principle: solve locally, submit remotely.
Basic Usage
-
Find a contest or problem
-
Set up contests locally
:CP codeforces 1848 -
Code and test
:CP run -
Navigate between problems
:CP next :CP prev :CP e1 -
Debug and edit test cases
:CP edit
:CP panel --debug
- Submit on the original website
Documentation
:help cp.nvim
See my config for the setup in the video shown above.
Motivation
I could not find a neovim-centric, efficient, dependency-free, flexible, and easily customizable competitive programming workflow that "just works"--so I made it myself. I conferenced with top competitive programmers at Carnegie Mellon Univerity and the University of Virginia and covered their (and my) pain points:
- Scraping: contests are automatically loaded asynchronously
- Test Case Management: test case editor (
:CP edit) - UI: both
runandpanellayouts cover common formats - Extensibility: snippet plugins, compilation, etc. are left to the programmer