feat(commands): add :CP <platform> signup subcommand (#337)

## Problem

No quick way to reach a platform's registration page from within Neovim.

## Solution

Add `signup` as a platform subcommand that calls `vim.ui.open` on the
platform's registration URL. URLs live in a new `SIGNUP_URLS` table in
`constants.lua`. Works even when the platform is disabled. Tab
completion and vimdoc updated.
This commit is contained in:
Barrett Ruth 2026-03-06 16:14:33 -05:00 committed by GitHub
parent e89c57558d
commit 4ef00afe66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -25,6 +25,15 @@ M.PLATFORM_DISPLAY_NAMES = {
usaco = 'USACO',
}
M.SIGNUP_URLS = {
atcoder = 'https://atcoder.jp/register',
codechef = 'https://www.codechef.com/register',
codeforces = 'https://codeforces.com/register',
cses = 'https://cses.fi/register',
kattis = 'https://open.kattis.com/register',
usaco = 'https://usaco.org/index.php?page=createaccount',
}
M.CPP = 'cpp'
M.PYTHON = 'python'

View file

@ -64,7 +64,7 @@ end, {
return filter_candidates(candidates)
elseif num_args == 3 then
if vim.tbl_contains(platforms, args[2]) then
local candidates = { 'login', 'logout' }
local candidates = { 'login', 'logout', 'signup' }
local cache = require('cp.cache')
cache.load()
vim.list_extend(candidates, cache.get_cached_contest_ids(args[2]))