Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 538 Bytes

run-a-lua-statement-from-the-command-prompt.md

File metadata and controls

25 lines (17 loc) · 538 Bytes

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.