Run Lua command for each line
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2red
blueCursor on line 1, column 1red
blueCursor on line 1, column 1RED
BLUECursor on line 1, column 1Run Lua command for each line.
Lua range
- Lines
1,$ (default whole buffer)
Command entered · ready to apply
Lua range
- Lines
1,$ (default whole buffer)
Command line
- Typed text
:luado return string.upper(line)- Insertion offset
32
:luado calls the body for every line; each returned uppercase string replaces that line.
Lua range
- Line 1 result
RED- Line 2 result
BLUE
Before & after
red
blueCursor on line 1, column 1Lua range
- Lines
1,$ (default whole buffer)
RED
BLUECursor on line 1, column 1Lua range
- Line 1 result
RED- Line 2 result
BLUE
Documentation-backed illustration. +lua and its standard string library; default luado range is the whole buffer. :luado calls the body for every line; each returned uppercase string replaces that line. Primary help: :luado.
Details & Vim help
Run Lua command for each line. 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 :luad[o] 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.