From c06d81959702fc6616dfda678346c2429c13993a Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 1 Feb 2026 17:01:29 -0500 Subject: [PATCH 01/10] fix(ci): fix rockspec url --- cp.nvim-scm-1.rockspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cp.nvim-scm-1.rockspec b/cp.nvim-scm-1.rockspec index e38d924..8152b7b 100644 --- a/cp.nvim-scm-1.rockspec +++ b/cp.nvim-scm-1.rockspec @@ -2,7 +2,7 @@ rockspec_format = '3.0' package = 'cp.nvim' version = 'scm-1' -source = { url = 'git://github.com/barrett-ruth/cp.nvim' } +source = { url = 'git://github.com/barrettruth/cp.nvim' } build = { type = 'builtin' } test_dependencies = { From 5cd6f75419466e4a10e0c4aaa18593fb49ddfebb Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 1 Feb 2026 17:11:51 -0500 Subject: [PATCH 02/10] fix username too --- doc/cp.nvim.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/cp.nvim.txt b/doc/cp.nvim.txt index 866346f..1371ef5 100644 --- a/doc/cp.nvim.txt +++ b/doc/cp.nvim.txt @@ -208,7 +208,7 @@ CONFIGURATION *cp-config* Here's an example configuration with lazy.nvim: >lua { - 'barrett-ruth/cp.nvim', + 'barrettruth/cp.nvim', cmd = 'CP', build = 'uv sync', opts = { From f184a7874ae353d545367ac24076fd6cd3359900 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 01:38:13 -0500 Subject: [PATCH 03/10] feat: update docs --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7d439f9..cc17d80 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,15 @@ https://github.com/user-attachments/assets/e81d8dfb-578f-4a79-9989-210164fc0148 - **Language agnostic**: Works with any language - **Diff viewer**: Compare expected vs actual output with 3 diff modes +## Installation + +Install using your package manager of choice or with +[luarocks](https://luarocks.org/modules/barrettruth/cp.nvim): + +``` +luarocks install cp.nvim +``` + ## Optional Dependencies - [uv](https://docs.astral.sh/uv/) for problem scraping From f9f993db0cbbe01ca63e79f290ec990e360d3438 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 01:39:26 -0500 Subject: [PATCH 04/10] fix: pre-commit syntax error --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 22e6d2e..410cfc2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: hooks: - id: prettier name: prettier - files: \.(md|,toml,yaml,sh)$ + files: \.(md,toml,yaml,sh)$ - repo: local hooks: From 01efc7c3441b7219909adb580c77a5531d2b29dc Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 01:41:35 -0500 Subject: [PATCH 05/10] fix(ci): prettier format --- .github/workflows/luarocks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/luarocks.yaml b/.github/workflows/luarocks.yaml index 95eaf0f..5be8b55 100644 --- a/.github/workflows/luarocks.yaml +++ b/.github/workflows/luarocks.yaml @@ -3,7 +3,7 @@ name: luarocks on: push: tags: - - "v*" + - 'v*' jobs: ci: From 08fb654d2341de8259e8e5c74ad8e636322b47d7 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 01:43:13 -0500 Subject: [PATCH 06/10] format yml too in pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 410cfc2..971ffbe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: hooks: - id: prettier name: prettier - files: \.(md,toml,yaml,sh)$ + files: \.(md|toml|ya?ml|sh)$ - repo: local hooks: From 11b8365aacdc59befe4c35bca97b35ac1aa96a6e Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 01:49:47 -0500 Subject: [PATCH 07/10] via, not main --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc17d80..cf82417 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ https://github.com/user-attachments/assets/e81d8dfb-578f-4a79-9989-210164fc0148 ## Installation -Install using your package manager of choice or with +Install using your package manager of choice or via [luarocks](https://luarocks.org/modules/barrettruth/cp.nvim): ``` From 1a7e9517baea7492db90c8b782efeb9479508ea1 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 01:50:22 -0500 Subject: [PATCH 08/10] force --- new | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 new diff --git a/new b/new new file mode 100644 index 0000000..e69de29 From ec487aa489dfdf330cb08b6b5f696fd62b1b02c9 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 16:12:47 -0500 Subject: [PATCH 09/10] feat: config update to viom.g --- doc/cp.nvim.txt | 115 +++++++++++++++++++++++------------------------- lua/cp/init.lua | 22 ++++----- 2 files changed, 66 insertions(+), 71 deletions(-) diff --git a/doc/cp.nvim.txt b/doc/cp.nvim.txt index 1371ef5..d6d1d73 100644 --- a/doc/cp.nvim.txt +++ b/doc/cp.nvim.txt @@ -205,71 +205,66 @@ Debug Builds ~ ============================================================================== CONFIGURATION *cp-config* -Here's an example configuration with lazy.nvim: +Configuration is done via `vim.g.cp_config`. Set this before using the plugin: >lua - { - 'barrettruth/cp.nvim', - cmd = 'CP', - build = 'uv sync', - opts = { - languages = { - cpp = { - extension = 'cc', - commands = { - build = { 'g++', '-std=c++17', '{source}', '-o', '{binary}', - '-fdiagnostics-color=always' }, - run = { '{binary}' }, - debug = { 'g++', '-std=c++17', '-fsanitize=address,undefined', - '{source}', '-o', '{binary}' }, - }, - }, - python = { - extension = 'py', - commands = { - run = { 'python', '{source}' }, - debug = { 'python', '{source}' }, - }, + vim.g.cp_config = { + languages = { + cpp = { + extension = 'cc', + commands = { + build = { 'g++', '-std=c++17', '{source}', '-o', '{binary}', + '-fdiagnostics-color=always' }, + run = { '{binary}' }, + debug = { 'g++', '-std=c++17', '-fsanitize=address,undefined', + '{source}', '-o', '{binary}' }, }, }, - platforms = { - cses = { - enabled_languages = { 'cpp', 'python' }, - default_language = 'cpp', - overrides = { - cpp = { extension = 'cpp', commands = { build = { ... } } } - }, - }, - atcoder = { - enabled_languages = { 'cpp', 'python' }, - default_language = 'cpp', - }, - codeforces = { - enabled_languages = { 'cpp', 'python' }, - default_language = 'cpp', + python = { + extension = 'py', + commands = { + run = { 'python', '{source}' }, + debug = { 'python', '{source}' }, }, }, - open_url = true, - debug = false, - ui = { - ansi = true, - run = { - width = 0.3, - next_test_key = '', -- or nil to disable - prev_test_key = '', -- or nil to disable + }, + platforms = { + cses = { + enabled_languages = { 'cpp', 'python' }, + default_language = 'cpp', + overrides = { + cpp = { extension = 'cpp', commands = { build = { ... } } } }, - panel = { - diff_modes = { 'side-by-side', 'git', 'vim' }, - max_output_lines = 50, - }, - diff = { - git = { - args = { 'diff', '--no-index', '--word-diff=plain', - '--word-diff-regex=.', '--no-prefix' }, - }, - }, - picker = 'telescope', }, - } + atcoder = { + enabled_languages = { 'cpp', 'python' }, + default_language = 'cpp', + }, + codeforces = { + enabled_languages = { 'cpp', 'python' }, + default_language = 'cpp', + }, + }, + open_url = true, + debug = false, + ui = { + ansi = true, + run = { + width = 0.3, + next_test_key = '', -- or nil to disable + prev_test_key = '', -- or nil to disable + }, + panel = { + diff_modes = { 'side-by-side', 'git', 'vim' }, + max_output_lines = 50, + }, + diff = { + git = { + args = { 'diff', '--no-index', '--word-diff=plain', + '--word-diff-regex=.', '--no-prefix' }, + }, + }, + picker = 'telescope', + }, } < @@ -279,7 +274,7 @@ the default; per-platform overrides can tweak 'extension' or 'commands'. For example, to run CodeForces contests with Python by default: >lua - { + vim.g.cp_config = { platforms = { codeforces = { default_language = 'python', @@ -290,7 +285,7 @@ For example, to run CodeForces contests with Python by default: Any language is supported provided the proper configuration. For example, to run CSES problems with Rust using the single schema: >lua - { + vim.g.cp_config = { languages = { rust = { extension = 'rs', diff --git a/lua/cp/init.lua b/lua/cp/init.lua index 64a997d..fac3044 100644 --- a/lua/cp/init.lua +++ b/lua/cp/init.lua @@ -11,25 +11,25 @@ if vim.fn.has('nvim-0.10.0') == 0 then return {} end -local user_config = {} -local config = nil local initialized = false +local function ensure_initialized() + if initialized then + return + end + local user_config = vim.g.cp_config or {} + local config = config_module.setup(user_config) + config_module.set_current_config(config) + initialized = true +end + ---@return nil function M.handle_command(opts) + ensure_initialized() local commands = require('cp.commands') commands.handle_command(opts) end -function M.setup(opts) - opts = opts or {} - user_config = opts - config = config_module.setup(user_config) - config_module.set_current_config(config) - - initialized = true -end - function M.is_initialized() return initialized end From dc635d5167e465df06e8ffe0212e4ff029541b35 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 3 Feb 2026 21:07:01 -0500 Subject: [PATCH 10/10] chore: add issue templates --- .github/ISSUE_TEMPLATE/bug_report.yaml | 78 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yaml | 5 ++ .github/ISSUE_TEMPLATE/feature_request.yaml | 30 ++++++++ 3 files changed, 113 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml create mode 100644 .github/ISSUE_TEMPLATE/config.yaml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..5742799 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,78 @@ +name: Bug Report +description: Report a bug +title: 'bug: ' +labels: [bug] +body: + - type: checkboxes + attributes: + label: Prerequisites + options: + - label: + I have searched [existing + issues](https://github.com/barrettruth/cp.nvim/issues) + required: true + - label: I have updated to the latest version + required: true + + - type: textarea + attributes: + label: 'Neovim version' + description: 'Output of `nvim --version`' + render: text + validations: + required: true + + - type: input + attributes: + label: 'Operating system' + placeholder: 'e.g. Arch Linux, macOS 15, Ubuntu 24.04' + validations: + required: true + + - type: textarea + attributes: + label: Description + description: What happened? What did you expect? + validations: + required: true + + - type: textarea + attributes: + label: Steps to reproduce + description: Minimal steps to trigger the bug + value: | + 1. + 2. + 3. + validations: + required: true + + - type: textarea + attributes: + label: 'Health check' + description: 'Output of `:checkhealth cp`' + render: text + + - type: textarea + attributes: + label: Minimal reproduction + description: | + Save the script below as `repro.lua`, edit if needed, and run: + ``` + nvim -u repro.lua + ``` + Confirm the bug reproduces with this config before submitting. + render: lua + value: | + vim.env.LAZY_STDPATH = '.repro' + load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))() + require('lazy.nvim').setup({ + spec = { + { + 'barrett-ruth/cp.nvim', + opts = {}, + }, + }, + }) + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 0000000..12ef1b0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Questions + url: https://github.com/barrettruth/cp.nvim/discussions + about: Ask questions and discuss ideas diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..39c6692 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,30 @@ +name: Feature Request +description: Suggest a feature +title: 'feat: ' +labels: [enhancement] +body: + - type: checkboxes + attributes: + label: Prerequisites + options: + - label: + I have searched [existing + issues](https://github.com/barrettruth/cp.nvim/issues) + required: true + + - type: textarea + attributes: + label: Problem + description: What problem does this solve? + validations: + required: true + + - type: textarea + attributes: + label: Proposed solution + validations: + required: true + + - type: textarea + attributes: + label: Alternatives considered