Vim Recall繁體中文

Run Lua command for each line

:luado

Example

Normal 0 / 2
red
blue
Cursor on line 1, column 1

Run Lua command for each line.

Lua range

Lines
1,$ (default whole buffer)
Before & after
Before
red
blue
Cursor on line 1, column 1

Lua range

Lines
1,$ (default whole buffer)
After
RED
BLUE
Cursor on line 1, column 1

Lua 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.