From ead5683ff9994c0fbfc6c38e0911d9455777550b Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 7 Jan 2025 14:20:45 +0100 Subject: feat(api): add err field to nvim_echo() opts Problem: We want to deprecate `nvim_err_write(ln)()` but there is no obvious replacement (from Lua). Meanwhile we already have `nvim_echo()` with an `opts` argument. Solution: Add `err` argument to `nvim_echo()` that directly maps to `:echoerr`. --- runtime/doc/api.txt | 2 ++ runtime/doc/news.txt | 2 ++ 2 files changed, 4 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index c8e0dcd0c5..514479b8ba 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -662,6 +662,8 @@ nvim_echo({chunks}, {history}, {opts}) *nvim_echo()* `hl_group` element can be omitted for no highlight. • {history} if true, add to |message-history|. • {opts} Optional parameters. + • err: Treat the message like |:echoerr|. Omitted `hlgroup` + uses |hl-ErrorMsg| instead. • verbose: Message is printed as a result of 'verbose' option. If Nvim was invoked with -V3log_file, the message will be redirected to the log_file and suppressed from diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index b7606e65f5..cb7916d0e9 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -178,6 +178,8 @@ API • Improved API "meta" docstrings and :help documentation. • |nvim__ns_set()| can set properties for a namespace +• |nvim_echo()| `err` field to print error messages and `chunks` accepts + highlight group IDs. DEFAULTS -- cgit From 5c92b40b4b173c7d85106689fef811e41994abb0 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 7 Jan 2025 16:38:29 +0100 Subject: feat(api): deprecate nvim_out/err_write(ln) --- runtime/doc/api.txt | 24 ------------------------ runtime/doc/deprecated.txt | 3 +++ 2 files changed, 3 insertions(+), 24 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 514479b8ba..852037bb34 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -669,23 +669,6 @@ nvim_echo({chunks}, {history}, {opts}) *nvim_echo()* will be redirected to the log_file and suppressed from direct output. -nvim_err_write({str}) *nvim_err_write()* - Writes a message to the Vim error buffer. Does not append "\n", the - message is buffered (won't display) until a linefeed is written. - - Parameters: ~ - • {str} Message - -nvim_err_writeln({str}) *nvim_err_writeln()* - Writes a message to the Vim error buffer. Appends "\n", so the buffer is - flushed (and displayed). - - Parameters: ~ - • {str} Message - - See also: ~ - • nvim_err_write() - nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()* Evaluates statusline string. @@ -1156,13 +1139,6 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()* Return: ~ Channel id, or 0 on error -nvim_out_write({str}) *nvim_out_write()* - Writes a message to the Vim output buffer. Does not append "\n", the - message is buffered (won't display) until a linefeed is written. - - Parameters: ~ - • {str} Message - nvim_paste({data}, {crlf}, {phase}) *nvim_paste()* Pastes at cursor (in any mode), and sets "redo" so dot (|.|) will repeat the input. UIs call this to implement "paste", but it's also intended for diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index ec98cc844f..dbdb8f541b 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -18,6 +18,9 @@ DEPRECATED IN 0.11 *deprecated-0.11* API • nvim_subscribe() Plugins must maintain their own "multicast" channels list. • nvim_unsubscribe() Plugins must maintain their own "multicast" channels list. +• nvim_out_write() Use |nvim_echo()|. +• nvim_err_write() Use |nvim_echo()| with `{err=true}`. +• nvim_err_writeln() Use |nvim_echo()| with `{err=true}`. DIAGNOSTICS • *vim.diagnostic.goto_next()* Use |vim.diagnostic.jump()| with `{count=1, float=true}` instead. -- cgit