mirror of
https://github.com/neovim/neovim.git
synced 2026-04-21 14:55:33 +00:00
docs: deprecate hit-enter
This commit is contained in:
@@ -157,7 +157,7 @@ indices, end-inclusive):
|
||||
*api-fast*
|
||||
Most API functions are "deferred": they are queued on the main loop and
|
||||
processed sequentially with normal input. So if the editor is waiting for
|
||||
user input in a "modal" fashion (e.g. the |hit-enter-prompt|), the request
|
||||
user input in a "modal" fashion (e.g. an |input()| prompt), the request
|
||||
will block. Non-deferred (fast) functions such as |nvim_get_mode()| and
|
||||
|nvim_input()| are served immediately (i.e. without waiting in the input
|
||||
queue). Lua code can use |vim.in_fast_event()| to detect a fast context.
|
||||
|
||||
@@ -52,6 +52,11 @@ LUA
|
||||
|
||||
• *vim.diff()* Renamed to |vim.text.diff()|
|
||||
|
||||
UI
|
||||
|
||||
• *hit-enter* *hit-enter-prompt* With |ui2|, the legacy "Press ENTER"
|
||||
*press-enter prompt is never triggered.
|
||||
|
||||
VIMSCRIPT
|
||||
|
||||
• todo
|
||||
|
||||
@@ -123,10 +123,11 @@ DEBUGGING TESTS
|
||||
|
||||
See `nvim_argv` in `test/functional/testnvim.lua`.
|
||||
|
||||
- Hanging tests can happen due to unexpected "press-enter" prompts. The
|
||||
default screen width is 50 columns. Commands that try to print lines longer
|
||||
than 50 columns in the command-line, e.g. `:edit very...long...path`, will
|
||||
trigger the prompt. Try using a shorter path, or `:silent edit`.
|
||||
- Hanging tests can happen due to unexpected modal prompts (waiting for user
|
||||
input). The default screen width is 50 columns.
|
||||
- Commands that try to print lines longer than 50 columns in the cmdline,
|
||||
e.g. `:edit very...long...path`, will trigger the hit-enter prompt. Try
|
||||
using a shorter path, or `:silent edit`.
|
||||
- If you can't figure out what is going on, try to visualize the screen. Put
|
||||
this at the beginning of your test: >
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
|
||||
@@ -5355,39 +5355,38 @@ vim.version.range({spec}) *vim.version.range()*
|
||||
==============================================================================
|
||||
UI2 *ui2*
|
||||
|
||||
WARNING: This is an experimental interface intended to replace the message
|
||||
grid in the TUI.
|
||||
WARNING: This is an experimental feature intended to replace the builtin
|
||||
message + cmdline presentation layer.
|
||||
|
||||
To enable the experimental UI (default opts shown): >lua
|
||||
To enable this feature (default opts shown): >lua
|
||||
require('vim._core.ui2').enable({
|
||||
enable = true, -- Whether to enable or disable the UI.
|
||||
msg = { -- Options related to the message module.
|
||||
---@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 and triggers to a target.
|
||||
targets = 'cmd',
|
||||
timeout = 4000, -- Time a message is visible in the message window.
|
||||
},
|
||||
enable = true, -- Whether to enable or disable the UI.
|
||||
msg = { -- Options related to the message module.
|
||||
---@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 and triggers to a target.
|
||||
targets = 'cmd',
|
||||
timeout = 4000, -- Time a message is visible in the message window.
|
||||
},
|
||||
})
|
||||
<
|
||||
|
||||
There are four separate window types used by this interface:
|
||||
• "cmd": The cmdline window; also used for 'showcmd', 'showmode', 'ruler', and
|
||||
messages if 'cmdheight' > 0.
|
||||
• "msg": The message window; used for messages when 'cmdheight' == 0.
|
||||
• "pager": The pager window; used for |:messages| and certain messages that
|
||||
should be shown in full.
|
||||
• "dialog": The dialog window; used for prompt messages that expect user
|
||||
input.
|
||||
There are four special windows/buffers for presenting messages and cmdline:
|
||||
• "cmd": Cmdline. Also used for 'showcmd', 'showmode', 'ruler', and messages
|
||||
if 'cmdheight' > 0.
|
||||
• "msg": Message window, shows messages when 'cmdheight' == 0.
|
||||
• "pager": Pager window, shows |:messages| and certain messages that are never
|
||||
"collapsed".
|
||||
• "dialog": Dialog window, shows modal prompts that expect user input.
|
||||
|
||||
These four windows are assigned the "cmd", "msg", "pager" and "dialog"
|
||||
'filetype' respectively. Use a |FileType| autocommand to configure any local
|
||||
options for these windows and their respective buffers.
|
||||
The buffer 'filetype' is to the above-listed id ("cmd", "msg", …). Handle
|
||||
the |FileType| event to configure any local options for these windows and
|
||||
their respective buffers.
|
||||
|
||||
Rather than a |hit-enter-prompt|, messages shown in the cmdline area that do
|
||||
not fit are appended with a `[+x]` "spill" indicator, where `x` indicates the
|
||||
spilled lines. To see the full message, use either:
|
||||
Unlike the legacy |hit-enter| prompt, messages that overflow the cmdline area
|
||||
are instead "collapsed", followed by a `[+x]` "spill" indicator, where `x`
|
||||
indicates the spilled lines. To see the full messages, do either:
|
||||
• ENTER immediately after a message from interactive |:| cmdline.
|
||||
• |g<| at any time.
|
||||
|
||||
|
||||
@@ -30,14 +30,9 @@ depends on the 'shortmess' option.
|
||||
The number of remembered messages is determined by the 'messagesopt' option.
|
||||
|
||||
*g<*
|
||||
The "g<" command can be used to see the last page of previous command output.
|
||||
This is especially useful if you accidentally typed <Space> at the hit-enter
|
||||
prompt. You are then back at the hit-enter prompt and can then scroll further
|
||||
back.
|
||||
Note: If the output has been stopped with "q" at the more prompt, it will only
|
||||
be displayed up to this point.
|
||||
The previous command output is cleared when another command produces output.
|
||||
The "g<" output is not redirected.
|
||||
The "g<" command shows the last page of previous command output.
|
||||
This only works when 'more' is set.
|
||||
With |ui2|: "g<" shows recent messages in the |pager|.
|
||||
|
||||
If you want to find help on a specific (error) message, use the ID at the
|
||||
start of the message. For example, to get help on the message: >
|
||||
@@ -840,65 +835,26 @@ error message and traceback.
|
||||
==============================================================================
|
||||
Messages *messages*
|
||||
|
||||
This is an (incomplete) overview of various messages that Vim gives:
|
||||
Messages are shown in the |ui2| messages area. If they exceed ("overflow") the
|
||||
area then they will be collapsed and a "spill" indicator will indicate how
|
||||
many lines were collapsed. Use |g<| to see the full messages.
|
||||
|
||||
*hit-enter* *press-enter* *hit-return*
|
||||
*press-return* *hit-enter-prompt* >
|
||||
|
||||
Press ENTER or type command to continue
|
||||
|
||||
This message is given when there is something on the screen for you to read,
|
||||
and the screen is about to be redrawn:
|
||||
- After executing an external command (e.g., ":!ls" and "=").
|
||||
- Something is displayed on the status line that is longer than the width of
|
||||
the window, or runs into the 'showcmd' or 'ruler' output.
|
||||
|
||||
-> Press <Enter> or <Space> to redraw the screen and continue, without that
|
||||
key being used otherwise.
|
||||
-> Press ':' or any other Normal mode command character to start that command.
|
||||
Note that after an external command some special keys, such as the cursor
|
||||
keys, may not work normally, because the terminal is still set to a state
|
||||
for executing the external command.
|
||||
-> Press 'k', <Up>, 'u', 'b' or 'g' to scroll back in the messages. This
|
||||
works the same way as at the |more-prompt|. Only works when 'more' is on.
|
||||
-> Pressing 'j', 'f', 'd' or <Down> is ignored when messages scrolled off the
|
||||
top of the screen and 'more' is on, to avoid that typing one 'j' or 'f' too
|
||||
many causes the messages to disappear.
|
||||
-> Press <C-Y> to copy (yank) a modeless selection to the clipboard register.
|
||||
-> Use a menu. The characters defined for Cmdline-mode are used.
|
||||
-> When 'mouse' contains the 'r' flag, clicking the left mouse button works
|
||||
like pressing <Space>. This makes it impossible to select text though.
|
||||
-> For the GUI clicking the left mouse button in the last line works like
|
||||
pressing <Space>.
|
||||
-> |q| won't start recording into a register (rationale: it is often used as
|
||||
"quit" prompt key by users)
|
||||
|
||||
If you accidentally hit <Enter> or <Space> and you want to see the displayed
|
||||
text then use |g<|. This only works when 'more' is set.
|
||||
|
||||
To reduce the number of hit-enter prompts:
|
||||
- Set 'messagesopt'.
|
||||
To avoid overflow ("spill") of the |ui2| messages area:
|
||||
- Set 'cmdheight' to 2 or higher.
|
||||
- Add flags to 'shortmess'.
|
||||
- Reset 'showcmd' and/or 'ruler'.
|
||||
- Make sure `:echo` text is within |v:echospace| screen cells.
|
||||
|
||||
If your script causes the hit-enter prompt and you don't know why, you may
|
||||
find the |v:scrollstart| variable useful.
|
||||
|
||||
Also see 'mouse'. The hit-enter message is highlighted with the |hl-Question|
|
||||
group.
|
||||
|
||||
|
||||
*more-prompt* *pager* >
|
||||
-- More --
|
||||
-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit
|
||||
f/d/j: screen/page/line down, b/u/k: up, <Esc>: stop paging
|
||||
|
||||
This message is given when the screen is filled with messages. It is only
|
||||
given when the 'more' option is on. It is highlighted with the |hl-MoreMsg|
|
||||
group.
|
||||
This message is given when the |ui2| modal dialog is active.
|
||||
Only when the 'more' option is on.
|
||||
Highlighted with the |hl-MoreMsg| group.
|
||||
|
||||
Type effect ~
|
||||
With |ui2|: use "g<" to show messages in the pager.
|
||||
|
||||
Type Effect ~
|
||||
<CR> or <NL> or j or <Down> one more line
|
||||
d down a page (half a screen)
|
||||
<Space> or f or <PageDown> or CTRL-F down a screen
|
||||
@@ -920,19 +876,6 @@ Type effect ~
|
||||
in Cmdline-mode.
|
||||
<LeftMouse> next page*
|
||||
|
||||
Any other key causes the meaning of the keys to be displayed.
|
||||
|
||||
* Clicking the left mouse button only works:
|
||||
- For the GUI: in the last line of the screen.
|
||||
- When 'r' is included in 'mouse' (but then selecting text won't work).
|
||||
|
||||
|
||||
Note: The typed key is directly obtained from the terminal, it is not mapped
|
||||
and typeahead is ignored.
|
||||
|
||||
The |g<| command can be used to see the last page of previous command output.
|
||||
This is especially useful if you accidentally typed <Space> at the hit-enter
|
||||
prompt.
|
||||
|
||||
==============================================================================
|
||||
Progress messages *progress-message*
|
||||
|
||||
@@ -1198,8 +1198,7 @@ running) you have additional options:
|
||||
List file names as with |:oldfiles|, and then prompt
|
||||
for a number. When the number is valid that file from
|
||||
the list is edited.
|
||||
If you get the |press-enter| prompt you can press "q"
|
||||
and still get the prompt to enter a file number.
|
||||
|
||||
Use [!] to abandon a modified buffer. |abandon|
|
||||
|
||||
SHADA FILE FORMAT *shada-format*
|
||||
|
||||
@@ -127,7 +127,9 @@ v:dying
|
||||
*v:echospace* *echospace-variable*
|
||||
v:echospace
|
||||
Number of screen cells that can be used for an `:echo` message
|
||||
in the last screen line before causing the |hit-enter-prompt|.
|
||||
in the last screen line before causing the |hit-enter| prompt
|
||||
(or "overflow" with |ui2|).
|
||||
|
||||
Depends on 'showcmd', 'ruler' and 'columns'. You need to
|
||||
check 'cmdheight' for whether there are full-width lines
|
||||
available above the last line.
|
||||
@@ -557,8 +559,6 @@ v:scrollstart
|
||||
screen to scroll up. It's only set when it is empty, thus the
|
||||
first reason is remembered. It is set to "Unknown" for a
|
||||
typed command.
|
||||
This can be used to find out why your script causes the
|
||||
hit-enter prompt.
|
||||
|
||||
*v:searchforward* *searchforward-variable*
|
||||
v:searchforward
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
--- @brief
|
||||
---
|
||||
---WARNING: This is an experimental interface intended to replace the message
|
||||
---grid in the TUI.
|
||||
--- WARNING: This is an experimental feature intended to replace the builtin message + cmdline
|
||||
--- presentation layer.
|
||||
---
|
||||
---To enable the experimental UI (default opts shown):
|
||||
---```lua
|
||||
---require('vim._core.ui2').enable({
|
||||
--- enable = true, -- Whether to enable or disable the UI.
|
||||
--- msg = { -- Options related to the message module.
|
||||
--- ---@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 and triggers to a target.
|
||||
--- targets = 'cmd',
|
||||
--- timeout = 4000, -- Time a message is visible in the message window.
|
||||
--- },
|
||||
---})
|
||||
---```
|
||||
--- To enable this feature (default opts shown):
|
||||
--- ```lua
|
||||
--- require('vim._core.ui2').enable({
|
||||
--- enable = true, -- Whether to enable or disable the UI.
|
||||
--- msg = { -- Options related to the message module.
|
||||
--- ---@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 and triggers to a target.
|
||||
--- targets = 'cmd',
|
||||
--- timeout = 4000, -- Time a message is visible in the message window.
|
||||
--- },
|
||||
--- })
|
||||
--- ```
|
||||
---
|
||||
---There are four separate window types used by this interface:
|
||||
---- "cmd": The cmdline window; also used for 'showcmd', 'showmode', 'ruler', and
|
||||
--- messages if 'cmdheight' > 0.
|
||||
---- "msg": The message window; used for messages when 'cmdheight' == 0.
|
||||
---- "pager": The pager window; used for |:messages| and certain messages
|
||||
--- that should be shown in full.
|
||||
---- "dialog": The dialog window; used for prompt messages that expect user input.
|
||||
--- There are four special windows/buffers for presenting messages and cmdline:
|
||||
--- - "cmd": Cmdline. Also used for 'showcmd', 'showmode', 'ruler', and messages if 'cmdheight' > 0.
|
||||
--- - "msg": Message window, shows messages when 'cmdheight' == 0.
|
||||
--- - "pager": Pager window, shows |:messages| and certain messages that are never "collapsed".
|
||||
--- - "dialog": Dialog window, shows modal prompts that expect user input.
|
||||
---
|
||||
---These four windows are assigned the "cmd", "msg", "pager" and "dialog"
|
||||
---'filetype' respectively. Use a |FileType| autocommand to configure any local
|
||||
---options for these windows and their respective buffers.
|
||||
--- The buffer 'filetype' is to the above-listed id ("cmd", "msg", …). Handle the |FileType| event
|
||||
--- to configure any local options for these windows and their respective buffers.
|
||||
---
|
||||
---Rather than a |hit-enter-prompt|, messages shown in the cmdline area that do
|
||||
---not fit are appended with a `[+x]` "spill" indicator, where `x` indicates the
|
||||
---spilled lines. To see the full message, use either:
|
||||
--- Unlike the legacy |hit-enter| prompt, messages that overflow the cmdline area are instead
|
||||
--- "collapsed", followed by a `[+x]` "spill" indicator, where `x` indicates the spilled lines. To
|
||||
--- see the full messages, do either:
|
||||
--- - ENTER immediately after a message from interactive |:| cmdline.
|
||||
--- - |g<| at any time.
|
||||
|
||||
|
||||
6
runtime/lua/vim/_meta/vvars.lua
generated
6
runtime/lua/vim/_meta/vvars.lua
generated
@@ -127,7 +127,9 @@ vim.v.ctype = ...
|
||||
vim.v.dying = ...
|
||||
|
||||
--- Number of screen cells that can be used for an `:echo` message
|
||||
--- in the last screen line before causing the `hit-enter-prompt`.
|
||||
--- in the last screen line before causing the `hit-enter` prompt
|
||||
--- (or "overflow" with `ui2`).
|
||||
---
|
||||
--- Depends on 'showcmd', 'ruler' and 'columns'. You need to
|
||||
--- check 'cmdheight' for whether there are full-width lines
|
||||
--- available above the last line.
|
||||
@@ -581,8 +583,6 @@ vim.v.relnum = ...
|
||||
--- screen to scroll up. It's only set when it is empty, thus the
|
||||
--- first reason is remembered. It is set to "Unknown" for a
|
||||
--- typed command.
|
||||
--- This can be used to find out why your script causes the
|
||||
--- hit-enter prompt.
|
||||
--- @type string
|
||||
vim.v.scrollstart = ...
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ local commands = {
|
||||
end,
|
||||
}
|
||||
|
||||
-- NOTE: Use `vim.schedule_wrap` to avoid press-enter after choosing code
|
||||
-- NOTE: Use `vim.schedule_wrap` to avoid hit-enter after choosing code
|
||||
-- action via built-in `vim.fn.inputlist()`
|
||||
--- @param params { command: string, arguments: table }
|
||||
--- @param callback function
|
||||
|
||||
@@ -144,7 +144,9 @@ M.vars = {
|
||||
type = 'integer',
|
||||
desc = [=[
|
||||
Number of screen cells that can be used for an `:echo` message
|
||||
in the last screen line before causing the |hit-enter-prompt|.
|
||||
in the last screen line before causing the |hit-enter| prompt
|
||||
(or "overflow" with |ui2|).
|
||||
|
||||
Depends on 'showcmd', 'ruler' and 'columns'. You need to
|
||||
check 'cmdheight' for whether there are full-width lines
|
||||
available above the last line.
|
||||
@@ -666,8 +668,6 @@ M.vars = {
|
||||
screen to scroll up. It's only set when it is empty, thus the
|
||||
first reason is remembered. It is set to "Unknown" for a
|
||||
typed command.
|
||||
This can be used to find out why your script causes the
|
||||
hit-enter prompt.
|
||||
]=],
|
||||
},
|
||||
searchforward = {
|
||||
|
||||
@@ -2182,7 +2182,7 @@ describe('API', function()
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it('during press-enter prompt without UI returns blocking=false', function()
|
||||
it('during hit-enter prompt without UI returns blocking=false', function()
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
command("echom 'msg1'")
|
||||
command("echom 'msg2'")
|
||||
@@ -2194,7 +2194,7 @@ describe('API', function()
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
end)
|
||||
|
||||
it('during press-enter prompt returns blocking=true', function()
|
||||
it('during hit-enter prompt returns blocking=true', function()
|
||||
api.nvim_ui_attach(80, 20, {})
|
||||
eq({ mode = 'n', blocking = false }, api.nvim_get_mode())
|
||||
command("echom 'msg1'")
|
||||
|
||||
@@ -158,7 +158,7 @@ describe(':mksession', function()
|
||||
-- Create a new test instance of Nvim.
|
||||
clear()
|
||||
|
||||
-- Use :silent to avoid press-enter prompt due to long path
|
||||
-- Use :silent to avoid hit-enter prompt due to long path
|
||||
command('silent source ' .. session_path)
|
||||
command('tabnext 1')
|
||||
eq(cwd_dir .. get_pathsep() .. tmpfile_base .. '1', fn.expand('%:p'))
|
||||
|
||||
@@ -3313,10 +3313,10 @@ describe('TUI FocusGained/FocusLost', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('in press-enter prompt', function()
|
||||
it('in hit-enter prompt', function()
|
||||
t.skip(is_os('win'), 'FIXME: some spaces have wrong attrs on Windows')
|
||||
feed_data(":echom 'msg1'|echom 'msg2'|echom 'msg3'|echom 'msg4'|echom 'msg5'\n")
|
||||
-- Execute :messages to provoke the press-enter prompt.
|
||||
-- Execute :messages to provoke the hit-enter prompt.
|
||||
feed_data(':messages\n')
|
||||
screen:expect([[
|
||||
msg1 |
|
||||
|
||||
Reference in New Issue
Block a user