Add tips on lua embedding

pull/19/head
Jae-Won Chung 4 years ago committed by Timothée Sterle
parent d2d8c721b7
commit 84c2399b47

@ -216,10 +216,6 @@ See also:
- `:help :lua`
- `:help :lua-heredoc`
#### Caveats
You don't get correct syntax highlighting when writing Lua in a .vim file. It might be more convenient to use the `:lua` command as an entry point for requiring external Lua files.
### :luado
This command executes a chunk of Lua code that acts on a range of lines in the current buffer. If no range is specified, the whole buffer is used instead. Whatever string is `return`ed from the chunk is used to determine what each line should be replaced with.
@ -399,6 +395,10 @@ echo v:lua.some_global_dict['key']
echo map([1, 2, 3], v:lua.global_callback)
```
### Tips
You can get Lua syntax highlighting inside .vim files by putting `let g:vimsyn_embed = 'l'` in your configuration file. See `:help g:vimsyn_embed` for more on this option.
## The vim namespace
Neovim exposes a global `vim` variable which serves as an entry point to interact with its APIs from Lua. It provides users with an extended "standard library" of functions as well as various sub-modules.

Loading…
Cancel
Save