aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2025-01-09 08:36:16 -0800
committerGitHub <noreply@github.com>2025-01-09 08:36:16 -0800
commit0c296ab22484b4c009d119908d1614a6c6d96b2c (patch)
tree45ca8593392c49a0b514df69f97b9617fc2c874b /runtime/doc
parent1e47aa677a24231ec771137dadc7c2b65be775b4 (diff)
downloadrneovim-0c296ab22484b4c009d119908d1614a6c6d96b2c.tar.gz
rneovim-0c296ab22484b4c009d119908d1614a6c6d96b2c.tar.bz2
rneovim-0c296ab22484b4c009d119908d1614a6c6d96b2c.zip
feat(docs): "yxx" runs Lua/Vimscript code examples #31904
`yxx` in Normal mode over a Lua or Vimscript code block section will execute the code. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/helphelp.txt1
-rw-r--r--runtime/doc/lua.txt6
-rw-r--r--runtime/doc/news.txt1
-rw-r--r--runtime/doc/terminal.txt4
-rw-r--r--runtime/doc/treesitter.txt4
-rw-r--r--runtime/doc/various.txt5
6 files changed, 14 insertions, 7 deletions
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index 46b3ab507d..f7009aebfe 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -193,6 +193,7 @@ Jump to specific subjects by using tags. This can be done in two ways:
Use CTRL-T or CTRL-O to jump back.
Use ":q" to close the help window.
+Use `yxx` to execute the current Lua/Vimscript code block.
If there are several matches for an item you are looking for, this is how you
can jump to each one of them:
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 6547a76f56..6386240f07 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -161,7 +161,7 @@ languages like Python and C#. Example: >lua
local func_with_opts = function(opts)
local will_do_foo = opts.foo
local filename = opts.filename
- ...
+ -- ...
end
func_with_opts { foo = true, filename = "hello.world" }
@@ -2428,7 +2428,7 @@ vim.validate({name}, {value}, {validator}, {optional}, {message})
function vim.startswith(s, prefix)
vim.validate('s', s, 'string')
vim.validate('prefix', prefix, 'string')
- ...
+ -- ...
end
<
2. `vim.validate(spec)` (deprecated) where `spec` is of type
@@ -2442,7 +2442,7 @@ vim.validate({name}, {value}, {validator}, {optional}, {message})
age={age, 'number'},
hobbies={hobbies, 'table'},
}
- ...
+ -- ...
end
<
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 960b6f05f9..e1824e068d 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -276,6 +276,7 @@ LUA
supporting two new parameters, `encoding` and `strict_indexing`.
• |vim.json.encode()| has an option to enable forward slash escaping
• |vim.fs.abspath()| converts paths to absolute paths.
+• Lua and vimscript code examples in docs can now be run using `yxx`.
OPTIONS
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index ff8e3a976f..7d79669ed8 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -165,8 +165,8 @@ directory indicated in the request. >lua
end
})
-To try it out, select the above code and source it with `:'<,'>lua`, then run
-this command in a :terminal buffer: >
+To try it out, select the above code and source it with `:'<,'>lua` (or
+`yxx`), then run this command in a :terminal buffer: >
printf "\033]7;file://./foo/bar\033\\"
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 28fe943359..538435e5e8 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -1336,7 +1336,7 @@ parse({lang}, {query}) *vim.treesitter.query.parse()*
`info.captures`).
• `info.patterns`: information about predicates.
- Example (select the code then run `:'<,'>lua` to try it): >lua
+ Example (to try it, use `yxx` or select the code then run `:'<,'>lua`): >lua
local query = vim.treesitter.query.parse('vimdoc', [[
; query
((h1) @str
@@ -1422,7 +1422,7 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
-- `node` was captured by the `name` capture in the match
local node_data = metadata[id] -- Node level metadata
- ... use the info here ...
+ -- ... use the info here ...
end
end
end
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 6074931565..611e820cab 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -554,6 +554,11 @@ gO Show a filetype-specific, navigable "outline" of the
*:sl!* *:sleep!*
:[N]sl[eep]! [N][m] Same as above, but hide the cursor.
+ *yxx*
+yxx Executes the current code block.
+
+ Works in |help| buffers.
+
==============================================================================
2. Using Vim like less or more *less*