mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-06 11:16:08 +00:00
refactor: Restructure keymaps and event handlers into centralized config-driven system
- Add M.setup() to cmd module for configuration
- Move describe editor config to M.config.describe.editor with nested structure
- Add keymaps config with separate log, status, and close sections
- Implement resolve_keymaps_from_specs() helper to build keymap lists from config
- Extract editor.open_editor() keymaps parameter support
- Move status/log event handlers from terminal.lua to cmd.lua
- Convert log/status buffer keymaps to config-driven approach with handler specs
This commit is contained in:
@@ -51,7 +51,8 @@ end
|
||||
|
||||
---@param initial_text string[] Lines to initialize the buffer with
|
||||
---@param on_done fun(buf: string[])? Optional callback called with user text on buffer write
|
||||
function M.open_editor(initial_text, on_done)
|
||||
---@param keymaps? jj.core.buffer.keymap[] Optional keymaps for the buffer
|
||||
function M.open_editor(initial_text, on_done, keymaps)
|
||||
-- Initialize highlight groups once
|
||||
init_highlights()
|
||||
|
||||
@@ -124,10 +125,7 @@ function M.open_editor(initial_text, on_done)
|
||||
size = math.floor(vim.o.lines / 2),
|
||||
buftype = "acwrite",
|
||||
modifiable = true,
|
||||
keymaps = {
|
||||
{ modes = "n", lhs = "q", rhs = "<cmd>close!<CR>", opts = { desc = "Close describe buffer" } },
|
||||
{ modes = "n", lhs = "<Esc>", rhs = "<cmd>close!<CR>", opts = { desc = "Close describe buffer" } },
|
||||
},
|
||||
keymaps = keymaps,
|
||||
})
|
||||
|
||||
-- Set buffer content
|
||||
|
||||
Reference in New Issue
Block a user