Run Lua script file
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2Run Lua script file.
Lua output
- Text
Command entered · ready to apply
Lua output
- Text
Command line
- Typed text
:luafile hello.lua- Insertion offset
18
:luafile loads and executes hello.lua; print sends the prepared string to Vim's message area.
Lua output
- Text
hello from file
Before & after
Before
Lua output
- Text
After
Lua output
- Text
hello from file
Documentation-backed illustration. +lua, working Lua runtime, and hello.lua containing exactly the displayed source. :luafile loads and executes hello.lua; print sends the prepared string to Vim's message area. Primary help: :luafile.
alpha
beta
gammaCursor on line 1, column 1Details & Vim help
Run Lua script file. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :luaf[ile] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative. This command requires a Vim build with +lua support and a compatible Lua library linked into Vim or available for dynamic loading.