cp.nvim/README.md
Barrett Ruth da4e2ebeba
feat: git credential backend for credential storage (#371)
## Problem

Credentials were stored as plaintext JSON in
`stdpath('data')/cp-nvim.json`, with no integration with system
credential managers.

## Solution

Replace file-based credential storage with `git credential
fill/approve/reject`, delegating to whatever credential helper the user
has configured (`cache`, `store`, `libsecret`, macOS Keychain, etc.).

- New `lua/cp/git_credential.lua` module wrapping the git credential
protocol
- All credential consumers (`credentials.lua`, `submit.lua`,
`scraper.lua`) use `git_credential` directly — `cache.lua` no longer
handles credentials
- CSES API token packed into the password field (`password<TAB>token`)
so it works with helpers that ignore the `path` field
- `has_helper()` guard on `:CP login`, `:CP logout`, and `:CP submit`
with an error message if no helper is configured
- Healthcheck split into `[required]`/`[optional]` sections; git version
and credential helper status shown
- `git` checked at startup in `check_required_runtime()`
- Cache version system (`CACHE_VERSION`, v1→v2 migration) removed — the
cache file is now a plain JSON blob
- `:CP` command gets `bar = true`
2026-03-07 20:15:06 -05:00

2.5 KiB

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, USACO, CSES, Kattis
  • Online Judge Integration: Submit problems and view contest standings
  • Live Contest Support: Participate in real-time contests
  • Automatic setup: Scrape test cases and metadata in seconds
  • Streamlined Editing: Configure coding view, edit test cases, stress-test solutions, run interactive problems, and more
  • Rich output: 256 color ANSI support for compiler errors and program output
  • Language agnosticism: Configure with any language
  • Security: Passwords go untampered

Installation

Install using your package manager of choice or via luarocks:

luarocks install cp.nvim

Dependencies

Quick Start

  1. Find a contest:
:CP pick
  1. View the problem:
:CP open
  1. Code and test
:CP run
  1. Navigate between problems
:CP next
:CP prev
:CP e1
  1. Debug and edit test cases
:CP edit
:CP panel --debug
  1. Submit:
:CP submit
  1. View contest standings:
:CP open standings

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 run and panel layouts cover common formats
  • Extensibility: snippet plugins, compilation, etc. are left to the programmer

Similar Projects