feat(commands): standalone :CP login/logout with auto-restore

Problem: `:CP login` and `:CP logout` only worked as `:CP <platform>
login`. Users with an active platform or in a registered buffer had to
type the platform name redundantly.

Solution: Parse standalone `login`/`logout`/`signup` as action commands
with `requires_context = true`, resolving the platform from state (or
auto-restoring from the current buffer). Add `vim.cmd.redraw()` after
auto-restore so the screen updates before any prompt. Add `login`/
`logout` to top-level completion when a platform is active.
This commit is contained in:
Barrett Ruth 2026-03-07 18:13:12 -05:00
parent e3c81e895a
commit 693d3bf172
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
3 changed files with 32 additions and 6 deletions

View file

@ -453,6 +453,7 @@ COMMANDS *cp-commands*
any previously saved credentials.
If [platform] is omitted, uses the active platform.
Examples: >
:CP login
:CP login atcoder
:CP login codeforces
<
@ -460,6 +461,7 @@ COMMANDS *cp-commands*
Remove stored credentials for a platform.
If [platform] is omitted, uses the active platform.
Examples: >
:CP logout
:CP logout atcoder
<
:CP {platform} signup