From e5aca06955ceb41a4061c657a3a78e036f060c3c Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Fri, 26 Sep 2025 09:53:32 -0400 Subject: [PATCH] feat(doc): document default setup --- doc/cp.txt | 20 +++++++++++++++++--- lua/cp/state.lua | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/cp.txt b/doc/cp.txt index 10e69c3..6299713 100644 --- a/doc/cp.txt +++ b/doc/cp.txt @@ -121,9 +121,8 @@ Template Variables ~ ============================================================================== CONFIGURATION *cp-config* -cp.nvim works out of the box. No setup required. - Here's an example configuration with lazy.nvim: >lua + { 'barrett-ruth/cp.nvim', cmd = 'CP', @@ -166,6 +165,21 @@ Here's an example configuration with lazy.nvim: >lua } < +By default, all contests are configured to use C++ with the g++ compiler and ISO standard +17. Python is also configured with the system executable python as a non-default option. Consult lua/cp/config.lua for +more information. + +For example, to run CodeForces contests with Python, only the following config +is required: + + { + contests = { + codeforces = { + default_langauge = 'python' + } + } + } + *cp.Config* Fields: ~ {contests} (table) Contest configurations. @@ -243,7 +257,7 @@ Here's an example configuration with lazy.nvim: >lua function(state: cp.State) Hook functions receive the cp.nvim state object (cp.State). See the state - module documentation for available methods and fields. + module documentation (lua/cp/state.lua) for available methods and fields. Example usage in hook: >lua hooks = { diff --git a/lua/cp/state.lua b/lua/cp/state.lua index ca38189..f827a50 100644 --- a/lua/cp/state.lua +++ b/lua/cp/state.lua @@ -5,6 +5,8 @@ ---@field set_contest_id fun(contest_id: string) ---@field get_problem_id fun(): string? ---@field set_problem_id fun(problem_id: string) +---@field get_active_panel fun(): string? +---@field set_active_panel fun(): string? ---@field get_test_cases fun(): table[]? ---@field set_test_cases fun(test_cases: table[]) ---@field get_saved_session fun(): table?