diff --git a/README.md b/README.md index e78969c..d339076 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1258 TILs and counting..._ +_1259 TILs and counting..._ --- @@ -541,6 +541,7 @@ _1258 TILs and counting..._ - [Allow Neovim To Copy/Paste With System Clipboard](neovim/allow-neovim-to-copy-paste-with-system-clipboard.md) - [Create User Command To Open Init Config](neovim/create-user-command-to-open-init-config.md) +- [Run A Lua Statement From The Command Prompt](neovim/run-a-lua-statement-from-the-command-prompt.md) - [Set Up Vim-Plug With Neovim](neovim/set-up-vim-plug-with-neovim.md) ### Netlify diff --git a/neovim/run-a-lua-statement-from-the-command-prompt.md b/neovim/run-a-lua-statement-from-the-command-prompt.md new file mode 100644 index 0000000..7136cce --- /dev/null +++ b/neovim/run-a-lua-statement-from-the-command-prompt.md @@ -0,0 +1,25 @@ +# Run A Lua Statement From The Command Prompt + +The `:lua` command is provided by Neovim as a way to execute a Lua _chunk_. + +I can use it to, for instance, execute a print statement. + +``` +:lua print('Hello, World!') +``` + +I could print out something more interesting like the full path of the current +file using `vim.fn.expand` with `%`. + +``` +:lua print(vim.fn.expand('%')) +``` + +Or as the helpfiles point out, I can see the value of some expression by +including a preceeding `=`. + +``` +:lua =jit.version +``` + +See `:h :lua` for more details.