feat: document bdingins
This commit is contained in:
parent
6a6cf2c594
commit
9ffc285e16
3 changed files with 55 additions and 13 deletions
|
|
@ -184,6 +184,11 @@ Here's an example configuration with lazy.nvim:
|
||||||
debug = false,
|
debug = false,
|
||||||
ui = {
|
ui = {
|
||||||
ansi = true,
|
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 = {
|
panel = {
|
||||||
diff_mode = 'vim',
|
diff_mode = 'vim',
|
||||||
max_output_lines = 50,
|
max_output_lines = 50,
|
||||||
|
|
@ -278,10 +283,20 @@ run CSES problems with Rust using the single schema:
|
||||||
Fields: ~
|
Fields: ~
|
||||||
{ansi} (boolean, default: true) Enable ANSI color parsing
|
{ansi} (boolean, default: true) Enable ANSI color parsing
|
||||||
and highlighting in both I/O view and panel.
|
and highlighting in both I/O view and panel.
|
||||||
|
{run} (|RunConfig|) I/O view configuration.
|
||||||
{panel} (|PanelConfig|) Test panel behavior configuration.
|
{panel} (|PanelConfig|) Test panel behavior configuration.
|
||||||
{diff} (|DiffConfig|) Diff backend configuration.
|
{diff} (|DiffConfig|) Diff backend configuration.
|
||||||
{picker} (string|nil) 'telescope', 'fzf-lua', or nil.
|
{picker} (string|nil) 'telescope', 'fzf-lua', or nil.
|
||||||
|
|
||||||
|
*RunConfig*
|
||||||
|
Fields: ~
|
||||||
|
{width} (number, default: 0.3) Width of I/O view splits as
|
||||||
|
fraction of screen (0.0 to 1.0).
|
||||||
|
{next_test_key} (string|nil, default: '<c-n>') Keymap to navigate
|
||||||
|
to next test in I/O view. Set to nil to disable.
|
||||||
|
{prev_test_key} (string|nil, default: '<c-p>') Keymap to navigate
|
||||||
|
to previous test in I/O view. Set to nil to disable.
|
||||||
|
|
||||||
*cp.PanelConfig*
|
*cp.PanelConfig*
|
||||||
Fields: ~
|
Fields: ~
|
||||||
{diff_mode} (string, default: "none") Diff backend: "none",
|
{diff_mode} (string, default: "none") Diff backend: "none",
|
||||||
|
|
@ -445,6 +460,12 @@ Usage ~
|
||||||
:CP run Run all tests
|
:CP run Run all tests
|
||||||
:CP run 3 Run test 3 only
|
:CP run 3 Run test 3 only
|
||||||
|
|
||||||
|
Navigation ~
|
||||||
|
|
||||||
|
While in the I/O view buffers, use the configured keymaps to cycle through tests:
|
||||||
|
<c-n> Next test (default, see |RunConfig|.next_test_key)
|
||||||
|
<c-p> Previous test (default, see |RunConfig|.prev_test_key)
|
||||||
|
|
||||||
Buffer Customization ~
|
Buffer Customization ~
|
||||||
|
|
||||||
Use the setup_io_input and setup_io_output hooks (see |cp.Hooks|) to customize
|
Use the setup_io_input and setup_io_output hooks (see |cp.Hooks|) to customize
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@
|
||||||
|
|
||||||
---@class RunConfig
|
---@class RunConfig
|
||||||
---@field width number
|
---@field width number
|
||||||
|
---@field next_test_key string|nil
|
||||||
|
---@field prev_test_key string|nil
|
||||||
|
|
||||||
---@class CpUI
|
---@class CpUI
|
||||||
---@field ansi boolean
|
---@field ansi boolean
|
||||||
|
|
@ -120,7 +122,7 @@ M.defaults = {
|
||||||
filename = nil,
|
filename = nil,
|
||||||
ui = {
|
ui = {
|
||||||
ansi = true,
|
ansi = true,
|
||||||
run = { width = 0.3 },
|
run = { width = 0.3, next_test_key = '<c-n>', prev_test_key = '<c-p>' },
|
||||||
panel = { diff_mode = 'none', max_output_lines = 50 },
|
panel = { diff_mode = 'none', max_output_lines = 50 },
|
||||||
diff = {
|
diff = {
|
||||||
git = {
|
git = {
|
||||||
|
|
@ -278,6 +280,20 @@ function M.setup(user_config)
|
||||||
'positive integer',
|
'positive integer',
|
||||||
},
|
},
|
||||||
git = { cfg.ui.diff.git, { 'table' } },
|
git = { cfg.ui.diff.git, { 'table' } },
|
||||||
|
next_test_key = {
|
||||||
|
cfg.ui.run.next_test_key,
|
||||||
|
function(v)
|
||||||
|
return v == nil or (type(v) == 'string' and #v > 0)
|
||||||
|
end,
|
||||||
|
'nil or non-empty string',
|
||||||
|
},
|
||||||
|
prev_test_key = {
|
||||||
|
cfg.ui.run.prev_test_key,
|
||||||
|
function(v)
|
||||||
|
return v == nil or (type(v) == 'string' and #v > 0)
|
||||||
|
end,
|
||||||
|
'nil or non-empty string',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
for id, lang in pairs(cfg.languages) do
|
for id, lang in pairs(cfg.languages) do
|
||||||
|
|
|
||||||
|
|
@ -273,18 +273,23 @@ function M.ensure_io_view()
|
||||||
M.run_io_view(new_index)
|
M.run_io_view(new_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', '<c-n>', function()
|
if config.ui.run.next_test_key then
|
||||||
navigate_test(1)
|
vim.keymap.set('n', config.ui.run.next_test_key, function()
|
||||||
end, { buffer = output_buf, silent = true, desc = 'Next test' })
|
navigate_test(1)
|
||||||
vim.keymap.set('n', '<c-p>', function()
|
end, { buffer = output_buf, silent = true, desc = 'Next test' })
|
||||||
navigate_test(-1)
|
vim.keymap.set('n', config.ui.run.next_test_key, function()
|
||||||
end, { buffer = output_buf, silent = true, desc = 'Previous test' })
|
navigate_test(1)
|
||||||
vim.keymap.set('n', '<c-n>', function()
|
end, { buffer = input_buf, silent = true, desc = 'Next test' })
|
||||||
navigate_test(1)
|
end
|
||||||
end, { buffer = input_buf, silent = true, desc = 'Next test' })
|
|
||||||
vim.keymap.set('n', '<c-p>', function()
|
if config.ui.run.prev_test_key then
|
||||||
navigate_test(-1)
|
vim.keymap.set('n', config.ui.run.prev_test_key, function()
|
||||||
end, { buffer = input_buf, silent = true, desc = 'Previous test' })
|
navigate_test(-1)
|
||||||
|
end, { buffer = output_buf, silent = true, desc = 'Previous test' })
|
||||||
|
vim.keymap.set('n', config.ui.run.prev_test_key, function()
|
||||||
|
navigate_test(-1)
|
||||||
|
end, { buffer = input_buf, silent = true, desc = 'Previous test' })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
utils.update_buffer_content(input_buf, {})
|
utils.update_buffer_content(input_buf, {})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue