feat(ui2): drop default enter-pager-via-CR mapping #40993

This commit is contained in:
Rob Pilling
2026-08-17 13:03:29 +01:00
committed by GitHub
parent 98053bfecf
commit a4aa0417cf
5 changed files with 17 additions and 2 deletions

View File

@@ -28,6 +28,7 @@
--- pager = { -- Options related to message window.
--- height = 0.999, -- Maximum height.
--- },
--- pager_char = nil, -- Key checked after interactive messages.
--- },
--- })
--- ```
@@ -47,6 +48,10 @@
--- indicates the spilled lines. To see the full messages, do either:
--- - ENTER immediately after interactive |:| cmdline shows a message and returns to |Normal-mode|.
--- - |g<| at any time.
---
--- If you'd like behavior similar to the old hit-enter prompt, pass `pager_char = "<CR>"` on
--- the `cfg` table. When the pager is shown, hitting `<CR>` (in this example) will enter the
--- pager.
local api = vim.api
local nvim_on = require('vim._core.util').nvim_on

View File

@@ -597,7 +597,8 @@ local function cmd_on_key(key, typed)
-- Check if window was entered and reopen with original config. A shown (but not entered)
-- pager is dismissed instead; "g<" passes through to reopen and enter it.
local can_enter = not api.nvim_get_mode().mode:match('[it]') and not pager_shown()
local enter = can_enter and (typed == '<CR>' or typed_g and (typed == '<lt>' or key == '<'))
local enter = can_enter
and (typed == ui.cfg.pager_char or typed_g and (typed == '<lt>' or key == '<'))
or (typed:find('LeftMouse') and fn.getmousepos().winid == ui.wins.cmd)
if enter then
M.expand_msg('cmd', 'pager', true)