feat(commands): add :CP <platform> signup subcommand
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. Works even when the platform is disabled in config. URLs live in a new `SIGNUP_URLS` table in `constants.lua`. Tab completion and vimdoc updated.
This commit is contained in:
parent
82640709d6
commit
e401c2863f
2 changed files with 10 additions and 1 deletions
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue