Vim Recall繁體中文

Make following command use legacy script syntax

:legacy

Example

Normal 0 / 2

Make following command use legacy script syntax.

Example variables

g:exampleCount
0

Example variables

g:exampleItems
[]
Before & after

Before

Example variables

g:exampleCount
0

Example variables

g:exampleItems
[]

After

Example variables

g:exampleCount
2

Example variables

g:exampleItems
[]

Start in Normal mode. The displayed :legacy command includes a complete following let statement. It runs in an existing legacy context and shows only the prepared global variables.

Sample buffer
one two
three four
five six
keep
Cursor on line 1, column 1
Details & Vim help

Example replayed in Vim

Make following command use legacy script syntax. 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 :leg[acy] 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. Supply a complete following Ex command; :legacy cannot stand alone. In Vim9 scripts and :def functions, the modifier requests legacy syntax, semantics and behavior for that command. Compiled Vim9 control-flow commands such as endif reject this modifier with E1189. The displayed Normal-mode example runs in an existing legacy context and assigns the prepared global variable.