aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-01-27 10:40:30 -0800
committerGitHub <noreply@github.com>2024-01-27 10:40:30 -0800
commit2cd76a758b4511748d9482e5af58162a608516b4 (patch)
tree78b62d3994171c769eb17061d097ec821d5504e3 /runtime
parent17b298b7c8a29ac3d54ea7adfa0e2ea09528e200 (diff)
downloadrneovim-2cd76a758b4511748d9482e5af58162a608516b4.tar.gz
rneovim-2cd76a758b4511748d9482e5af58162a608516b4.tar.bz2
rneovim-2cd76a758b4511748d9482e5af58162a608516b4.zip
docs(lua): update ":{range}lua" docs + error message #27231
- `:lua (no file)` is misleading because `:lua` never takes a file arg, unlike `:source`. - Update various related docs.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/lua.txt15
-rw-r--r--runtime/doc/repeat.txt8
2 files changed, 12 insertions, 11 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index fecdfd9bd0..7aa2fd5a6f 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -255,10 +255,13 @@ arguments separated by " " (space) instead of "\t" (tab).
:lua =jit.version
<
:{range}lua
- Executes the |[range]| in the current buffer as Lua code. Unlike |:source|,
- this will execute the specified lines regardless of the extension or
- |'filetype'| of the buffer.
+ Executes buffer lines in {range} as Lua code. Unlike |:source|, this
+ always treats the lines as Lua code.
+ Example: select the following code and type ":lua<Enter>" to execute it: >lua
+ print(string.format(
+ 'unix time: %s', os.time()))
+<
*:lua-heredoc*
:lua << [trim] [{endmarker}]
{script}
@@ -271,10 +274,8 @@ arguments separated by " " (space) instead of "\t" (tab).
function! CurrentLineInfo()
lua << EOF
local linenr = vim.api.nvim_win_get_cursor(0)[1]
- local curline = vim.api.nvim_buf_get_lines(
- 0, linenr - 1, linenr, false)[1]
- print(string.format("Current line [%d] has %d bytes",
- linenr, #curline))
+ local curline = vim.api.nvim_buf_get_lines(0, linenr - 1, linenr, false)[1]
+ print(string.format('Line [%d] has %d bytes', linenr, #curline))
EOF
endfunction
<
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 726d7a9591..ae827fa06f 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -192,11 +192,11 @@ Using Vim scripts *using-scripts*
For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
*:so* *:source* *load-vim-script*
-:[range]so[urce] [file] Runs |Ex| commands or Lua code (".lua" files) from
+:[range]so[urce] [file] Runs |Ex-commands| or Lua code (".lua" files) from
[file].
- If no [file], the current buffer is used, and it is
- treated as Lua code if its 'filetype' is "lua" or its
- file name ends with ".lua".
+ If no [file], the current buffer is used and treated
+ as Lua code if 'filetype' is "lua" or its filename
+ ends with ".lua".
Triggers the |SourcePre| autocommand.
*:source!*
:[range]so[urce]! {file}