mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 03:12:00 +00:00
feat(ui2): support routing "typed_cmd" trigger to target
Problem: Unable to immediately open a typed command in the pager.
Solution: Support mapping msg_show "typed_cmd" trigger in
cfg.msg.targets (e.g. `targets = { typed_cmd = 'pager' }`).
This commit is contained in:
@@ -5288,7 +5288,7 @@ To enable the experimental UI (default opts shown): >lua
|
||||
---@type 'cmd'|'msg' Default message target, either in the
|
||||
---cmdline or in a separate ephemeral message window.
|
||||
---@type string|table<string, 'cmd'|'msg'|'pager'> Default message target
|
||||
or table mapping |ui-messages| kinds to a target.
|
||||
or table mapping |ui-messages| kinds and triggers to a target.
|
||||
targets = 'cmd',
|
||||
timeout = 4000, -- Time a message is visible in the message window.
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
--- ---@type 'cmd'|'msg' Default message target, either in the
|
||||
--- ---cmdline or in a separate ephemeral message window.
|
||||
--- ---@type string|table<string, 'cmd'|'msg'|'pager'> Default message target
|
||||
--- or table mapping |ui-messages| kinds to a target.
|
||||
--- or table mapping |ui-messages| kinds and triggers to a target.
|
||||
--- targets = 'cmd',
|
||||
--- timeout = 4000, -- Time a message is visible in the message window.
|
||||
--- },
|
||||
|
||||
@@ -386,9 +386,14 @@ end
|
||||
--@param history boolean
|
||||
---@param append boolean
|
||||
---@param id integer|string
|
||||
function M.msg_show(kind, content, replace_last, _, append, id)
|
||||
-- Set the entered search command in the cmdline (if available).
|
||||
local tgt = kind == 'search_cmd' and 'cmd' or ui.cfg.msg.targets[kind] or ui.cfg.msg.target
|
||||
---@param trigger string
|
||||
function M.msg_show(kind, content, replace_last, _, append, id, trigger)
|
||||
-- Set the entered search command in the cmdline (if available). Otherwise route
|
||||
-- to configured target: 'trigger' takes precedence over 'kind.'
|
||||
local tgt = kind == 'search_cmd' and 'cmd'
|
||||
or ui.cfg.msg.targets[trigger]
|
||||
or ui.cfg.msg.targets[kind]
|
||||
or ui.cfg.msg.target
|
||||
if kind == 'search_cmd' and ui.cmdheight == 0 then
|
||||
-- Blocked by messaging() without ext_messages. TODO: look at other messaging() guards.
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user