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,
|
||||
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_mode = 'vim',
|
||||
max_output_lines = 50,
|
||||
|
|
@ -278,10 +283,20 @@ run CSES problems with Rust using the single schema:
|
|||
Fields: ~
|
||||
{ansi} (boolean, default: true) Enable ANSI color parsing
|
||||
and highlighting in both I/O view and panel.
|
||||
{run} (|RunConfig|) I/O view configuration.
|
||||
{panel} (|PanelConfig|) Test panel behavior configuration.
|
||||
{diff} (|DiffConfig|) Diff backend configuration.
|
||||
{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*
|
||||
Fields: ~
|
||||
{diff_mode} (string, default: "none") Diff backend: "none",
|
||||
|
|
@ -445,6 +460,12 @@ Usage ~
|
|||
:CP run Run all tests
|
||||
: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 ~
|
||||
|
||||
Use the setup_io_input and setup_io_output hooks (see |cp.Hooks|) to customize
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
---@class RunConfig
|
||||
---@field width number
|
||||
---@field next_test_key string|nil
|
||||
---@field prev_test_key string|nil
|
||||
|
||||
---@class CpUI
|
||||
---@field ansi boolean
|
||||
|
|
@ -120,7 +122,7 @@ M.defaults = {
|
|||
filename = nil,
|
||||
ui = {
|
||||
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 },
|
||||
diff = {
|
||||
git = {
|
||||
|
|
@ -278,6 +280,20 @@ function M.setup(user_config)
|
|||
'positive integer',
|
||||
},
|
||||
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
|
||||
|
|
|
|||
|
|
@ -273,18 +273,23 @@ function M.ensure_io_view()
|
|||
M.run_io_view(new_index)
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<c-n>', function()
|
||||
navigate_test(1)
|
||||
end, { buffer = output_buf, silent = true, desc = 'Next test' })
|
||||
vim.keymap.set('n', '<c-p>', function()
|
||||
navigate_test(-1)
|
||||
end, { buffer = output_buf, silent = true, desc = 'Previous test' })
|
||||
vim.keymap.set('n', '<c-n>', function()
|
||||
navigate_test(1)
|
||||
end, { buffer = input_buf, silent = true, desc = 'Next test' })
|
||||
vim.keymap.set('n', '<c-p>', function()
|
||||
navigate_test(-1)
|
||||
end, { buffer = input_buf, silent = true, desc = 'Previous test' })
|
||||
if config.ui.run.next_test_key then
|
||||
vim.keymap.set('n', config.ui.run.next_test_key, function()
|
||||
navigate_test(1)
|
||||
end, { buffer = output_buf, silent = true, desc = 'Next test' })
|
||||
vim.keymap.set('n', config.ui.run.next_test_key, function()
|
||||
navigate_test(1)
|
||||
end, { buffer = input_buf, silent = true, desc = 'Next test' })
|
||||
end
|
||||
|
||||
if config.ui.run.prev_test_key then
|
||||
vim.keymap.set('n', config.ui.run.prev_test_key, function()
|
||||
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
|
||||
|
||||
utils.update_buffer_content(input_buf, {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue