Merge pull request #22743 from bfredl/luaequals

feat(lua): allow `:=expr` as a shorter version of `:lua =expr`
This commit is contained in:
bfredl
2023-03-22 10:59:38 +01:00
committed by GitHub
10 changed files with 41 additions and 19 deletions

View File

@@ -233,11 +233,11 @@ command calls. The |lua-stdlib| modules, user modules, and anything else on
The Lua print() function redirects its output to the Nvim message area, with
arguments separated by " " (space) instead of "\t" (tab).
*:lua*
*:lua=* *:lua*
:lua {chunk}
Executes Lua chunk {chunk}. If {chunk} starts with "=" the rest of the
chunk is evaluated as an expression and printed. `:lua =expr` is
equivalent to `:lua print(vim.inspect(expr))`
chunk is evaluated as an expression and printed. `:lua =expr` or `:=expr` is
equivalent to `:lua print(vim.inspect(expr))`.
Examples: >vim
:lua vim.api.nvim_command('echo "Hello, Nvim!"')

View File

@@ -237,6 +237,11 @@ The following changes to existing APIs or features add new behavior.
• The `win_viewport` UI event now contains information about virtual lines,
meaning that smooth scrolling can now be implemented more consistenlty.
• The `:= {expr}` syntax can be used to evaluate a lua expression, as
a shorter form of `:lua ={expr}`. `:=` and `:[range]=` without argument
are unchanged. However `:=#` and similar variants using |ex-flags|
are no longer supported.
==============================================================================
REMOVED FEATURES *news-removed*

View File

@@ -173,13 +173,12 @@ g8 Print the hex values of the bytes used in the
Like ":z" or ":z!", but number the lines.
*:=*
:= [flags] Print the last line number.
See |ex-flags| for [flags].
:= Without arg: Print the last line number.
with args: equivalent to `:lua ={expr}`. see |:lua|
:{range}= [flags] Prints the last line number in {range}. For example,
:{range}= Prints the last line number in {range}. For example,
this prints the current line number: >
:.=
< See |ex-flags| for [flags].
:norm[al][!] {commands} *:norm* *:normal*
Execute Normal mode commands {commands}. This makes

View File

@@ -460,6 +460,7 @@ Commands:
|:doautocmd| does not warn about "No matching autocommands".
|:wincmd| accepts a count.
`:write!` does not show a prompt if the file was updated externally.
|:=| does not accept |ex-flags|. With an arg it is equivalent to |:lua=|
Command-line:
The meanings of arrow keys do not change depending on 'wildoptions'.