From 4ef00afe6677454794449caf64d0a67efdcb5d9b Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:14:33 -0500 Subject: [PATCH] feat(commands): add `:CP 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. --- lua/cp/constants.lua | 9 +++++++++ plugin/cp.lua | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/cp/constants.lua b/lua/cp/constants.lua index b0dad5b..94c28ba 100644 --- a/lua/cp/constants.lua +++ b/lua/cp/constants.lua @@ -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' diff --git a/plugin/cp.lua b/plugin/cp.lua index 3e3b56c..2baa1e3 100644 --- a/plugin/cp.lua +++ b/plugin/cp.lua @@ -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]))