Compare commits
No commits in common. "chore/add-issue-templates" and "fix/doc" have entirely different histories.
chore/add-
...
fix/doc
6 changed files with 70 additions and 178 deletions
78
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
78
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
|
|
@ -1,78 +0,0 @@
|
||||||
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
|
|
||||||
5
.github/ISSUE_TEMPLATE/config.yaml
vendored
5
.github/ISSUE_TEMPLATE/config.yaml
vendored
|
|
@ -1,5 +0,0 @@
|
||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Questions
|
|
||||||
url: https://github.com/barrettruth/cp.nvim/discussions
|
|
||||||
about: Ask questions and discuss ideas
|
|
||||||
30
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
30
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
|
|
@ -1,30 +0,0 @@
|
||||||
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
|
|
||||||
113
doc/cp.nvim.txt
113
doc/cp.nvim.txt
|
|
@ -205,66 +205,71 @@ Debug Builds ~
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CONFIGURATION *cp-config*
|
CONFIGURATION *cp-config*
|
||||||
|
|
||||||
Configuration is done via `vim.g.cp_config`. Set this before using the plugin:
|
Here's an example configuration with lazy.nvim:
|
||||||
>lua
|
>lua
|
||||||
vim.g.cp_config = {
|
{
|
||||||
languages = {
|
'barrettruth/cp.nvim',
|
||||||
cpp = {
|
cmd = 'CP',
|
||||||
extension = 'cc',
|
build = 'uv sync',
|
||||||
commands = {
|
opts = {
|
||||||
build = { 'g++', '-std=c++17', '{source}', '-o', '{binary}',
|
languages = {
|
||||||
'-fdiagnostics-color=always' },
|
cpp = {
|
||||||
run = { '{binary}' },
|
extension = 'cc',
|
||||||
debug = { 'g++', '-std=c++17', '-fsanitize=address,undefined',
|
commands = {
|
||||||
'{source}', '-o', '{binary}' },
|
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}' },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
python = {
|
platforms = {
|
||||||
extension = 'py',
|
cses = {
|
||||||
commands = {
|
enabled_languages = { 'cpp', 'python' },
|
||||||
run = { 'python', '{source}' },
|
default_language = 'cpp',
|
||||||
debug = { 'python', '{source}' },
|
overrides = {
|
||||||
|
cpp = { extension = 'cpp', commands = { build = { ... } } }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
atcoder = {
|
||||||
|
enabled_languages = { 'cpp', 'python' },
|
||||||
|
default_language = 'cpp',
|
||||||
|
},
|
||||||
|
codeforces = {
|
||||||
|
enabled_languages = { 'cpp', 'python' },
|
||||||
|
default_language = 'cpp',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
open_url = true,
|
||||||
platforms = {
|
debug = false,
|
||||||
cses = {
|
ui = {
|
||||||
enabled_languages = { 'cpp', 'python' },
|
ansi = true,
|
||||||
default_language = 'cpp',
|
run = {
|
||||||
overrides = {
|
width = 0.3,
|
||||||
cpp = { extension = 'cpp', commands = { build = { ... } } }
|
next_test_key = '<c-n>', -- or nil to disable
|
||||||
|
prev_test_key = '<c-p>', -- or nil to disable
|
||||||
},
|
},
|
||||||
},
|
panel = {
|
||||||
atcoder = {
|
diff_modes = { 'side-by-side', 'git', 'vim' },
|
||||||
enabled_languages = { 'cpp', 'python' },
|
max_output_lines = 50,
|
||||||
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 = '<c-n>', -- or nil to disable
|
|
||||||
prev_test_key = '<c-p>', -- 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' },
|
|
||||||
},
|
},
|
||||||
|
diff = {
|
||||||
|
git = {
|
||||||
|
args = { 'diff', '--no-index', '--word-diff=plain',
|
||||||
|
'--word-diff-regex=.', '--no-prefix' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
picker = 'telescope',
|
||||||
},
|
},
|
||||||
picker = 'telescope',
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
@ -274,7 +279,7 @@ the default; per-platform overrides can tweak 'extension' or 'commands'.
|
||||||
|
|
||||||
For example, to run CodeForces contests with Python by default:
|
For example, to run CodeForces contests with Python by default:
|
||||||
>lua
|
>lua
|
||||||
vim.g.cp_config = {
|
{
|
||||||
platforms = {
|
platforms = {
|
||||||
codeforces = {
|
codeforces = {
|
||||||
default_language = 'python',
|
default_language = 'python',
|
||||||
|
|
@ -285,7 +290,7 @@ For example, to run CodeForces contests with Python by default:
|
||||||
Any language is supported provided the proper configuration. For example, to
|
Any language is supported provided the proper configuration. For example, to
|
||||||
run CSES problems with Rust using the single schema:
|
run CSES problems with Rust using the single schema:
|
||||||
>lua
|
>lua
|
||||||
vim.g.cp_config = {
|
{
|
||||||
languages = {
|
languages = {
|
||||||
rust = {
|
rust = {
|
||||||
extension = 'rs',
|
extension = 'rs',
|
||||||
|
|
|
||||||
|
|
@ -11,25 +11,25 @@ if vim.fn.has('nvim-0.10.0') == 0 then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local user_config = {}
|
||||||
|
local config = nil
|
||||||
local initialized = false
|
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
|
---@return nil
|
||||||
function M.handle_command(opts)
|
function M.handle_command(opts)
|
||||||
ensure_initialized()
|
|
||||||
local commands = require('cp.commands')
|
local commands = require('cp.commands')
|
||||||
commands.handle_command(opts)
|
commands.handle_command(opts)
|
||||||
end
|
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()
|
function M.is_initialized()
|
||||||
return initialized
|
return initialized
|
||||||
end
|
end
|
||||||
|
|
|
||||||
0
new
0
new
Loading…
Add table
Add a link
Reference in a new issue