aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2026-03-04 14:51:21 +0100
committerLuuk van Baal <luukvbaal@gmail.com>2026-03-04 15:07:38 +0100
commit875212c5b3b879cd10bcd545e45de5293b2b3283 (patch)
tree57eaa42686f4dae39ef7b911f964a2e4f278b4f4 /runtime/lua/vim
parent97549ad7cf2359d96f607c27c5b4b8cf640698e2 (diff)
downloadrneovim-875212c5b3b879cd10bcd545e45de5293b2b3283.tar.gz
rneovim-875212c5b3b879cd10bcd545e45de5293b2b3283.tar.bz2
rneovim-875212c5b3b879cd10bcd545e45de5293b2b3283.zip
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' }`).
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/_core/ui2.lua2
-rw-r--r--runtime/lua/vim/_core/ui2/messages.lua11
2 files changed, 9 insertions, 4 deletions
diff --git a/runtime/lua/vim/_core/ui2.lua b/runtime/lua/vim/_core/ui2.lua
index b7ce79a76b..6766892f9b 100644
--- a/runtime/lua/vim/_core/ui2.lua
+++ b/runtime/lua/vim/_core/ui2.lua
@@ -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.
--- },
diff --git a/runtime/lua/vim/_core/ui2/messages.lua b/runtime/lua/vim/_core/ui2/messages.lua
index 1f946553c5..897b321728 100644
--- a/runtime/lua/vim/_core/ui2/messages.lua
+++ b/runtime/lua/vim/_core/ui2/messages.lua
@@ -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