remove keys

This commit is contained in:
Barrett Ruth 2025-10-02 10:23:01 -04:00
parent 91e6fbe455
commit 57be0c0044
4 changed files with 15 additions and 25 deletions

View file

@ -83,6 +83,7 @@ COMMANDS *cp-commands*
:CP cache read
View the cache in a pretty-printed lua buffer.
Exit with q.
Command Flags ~
*cp-flags*
@ -153,7 +154,6 @@ Here's an example configuration with lazy.nvim: >lua
diff_mode = 'vim',
next_test_key = '<c-n>',
prev_test_key = '<c-p>',
toggle_diff_key = '<c-q>',
max_output_lines = 50,
},
diff = {
@ -231,7 +231,6 @@ is required:
{next_test_key} (string, default: "<c-n>") Key to navigate to next test case.
{prev_test_key} (string, default: "<c-p>") Key to navigate to previous test case.
{toggle_diff_key} (string, default: "<c-t>") Key to cycle through diff modes.
{close_key} (string, default: "<c-q>") Close the run panel/interactive terminal
{max_output_lines} (number, default: 50) Maximum lines of test output.
*cp.DiffConfig*
@ -535,9 +534,8 @@ RUN PANEL KEYMAPS *cp-test-keys*
run_panel.next_test_key)
<c-p> Navigate to previous test case (configurable via
run_panel.prev_test_key)
<c-t> Cycle through diff modes: none → git → vim (configurable
via run_panel.toggle_diff_key)
<c-q> Exit run panel/interactive terminal and restore layout
t Cycle through diff modes: none → git → vim
q Exit run panel/interactive terminal and restore layout
Diff Modes ~

View file

@ -21,6 +21,16 @@ function M.handle_cache_command(cmd)
vim.api.nvim_buf_set_name(buf, name)
vim.api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(data, '\n'))
vim.bo[buf].filetype = 'lua'
vim.bo[buf].buftype = 'nofile'
vim.bo[buf].bufhidden = 'wipe'
vim.bo[buf].swapfile = false
vim.api.nvim_buf_set_keymap(
buf,
'n',
'q',
'<cmd>bd!<cr>',
{ nowait = true, noremap = true, silent = true }
)
end
vim.api.nvim_set_current_buf(buf)

View file

@ -33,8 +33,6 @@
---@field diff_mode "none"|"vim"|"git" Diff backend to use
---@field next_test_key string Key to navigate to next test case
---@field prev_test_key string Key to navigate to previous test case
---@field toggle_diff_key string Key to cycle through diff modes
---@field close_key string Key to close panel/interactive terminal
---@field max_output_lines number Maximum lines of test output to display
---@class DiffGitConfig
@ -104,8 +102,6 @@ M.defaults = {
diff_mode = 'none',
next_test_key = '<c-n>',
prev_test_key = '<c-p>',
toggle_diff_key = '<c-t>',
close_key = '<c-q>',
max_output_lines = 50,
},
diff = {
@ -224,20 +220,6 @@ function M.setup(user_config)
end,
'prev_test_key must be a non-empty string',
},
toggle_diff_key = {
config.run_panel.toggle_diff_key,
function(value)
return type(value) == 'string' and value ~= ''
end,
'toggle_diff_key must be a non-empty string',
},
close_key = {
config.run_panel.close_key,
function(value)
return type(value) == 'string' and value ~= ''
end,
'close_key must be a non-empty string',
},
max_output_lines = {
config.run_panel.max_output_lines,
function(value)

View file

@ -237,10 +237,10 @@ function M.toggle_run_panel(is_debug)
end
setup_keybindings_for_buffer = function(buf)
vim.keymap.set('n', config.run_panel.close_key, function()
vim.keymap.set('n', 'q', function()
M.toggle_run_panel()
end, { buffer = buf, silent = true })
vim.keymap.set('n', config.run_panel.toggle_diff_key, function()
vim.keymap.set('n', 't', function()
local modes = { 'none', 'git', 'vim' }
local current_idx = nil
for i, mode in ipairs(modes) do