Skip to content

Commit 542ff35

Browse files
committed
Add Run A Lua Statement From The Command Prompt as a Neovim TIL
1 parent 9e13593 commit 542ff35

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1258 TILs and counting..._
13+
_1259 TILs and counting..._
1414

1515
---
1616

@@ -541,6 +541,7 @@ _1258 TILs and counting..._
541541

542542
- [Allow Neovim To Copy/Paste With System Clipboard](neovim/allow-neovim-to-copy-paste-with-system-clipboard.md)
543543
- [Create User Command To Open Init Config](neovim/create-user-command-to-open-init-config.md)
544+
- [Run A Lua Statement From The Command Prompt](neovim/run-a-lua-statement-from-the-command-prompt.md)
544545
- [Set Up Vim-Plug With Neovim](neovim/set-up-vim-plug-with-neovim.md)
545546

546547
### Netlify
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Run A Lua Statement From The Command Prompt
2+
3+
The `:lua` command is provided by Neovim as a way to execute a Lua _chunk_.
4+
5+
I can use it to, for instance, execute a print statement.
6+
7+
```
8+
:lua print('Hello, World!')
9+
```
10+
11+
I could print out something more interesting like the full path of the current
12+
file using `vim.fn.expand` with `%`.
13+
14+
```
15+
:lua print(vim.fn.expand('%'))
16+
```
17+
18+
Or as the helpfiles point out, I can see the value of some expression by
19+
including a preceeding `=`.
20+
21+
```
22+
:lua =jit.version
23+
```
24+
25+
See `:h :lua` for more details.

0 commit comments

Comments
 (0)