Vim Recall繁體中文

End of a class declaration

:endclass

Example

Normal 0 / 2

End of a class declaration.

Script runtime

Load state
not sourced
Before & after

Before

Script runtime

Load state
not sourced

After

Script runtime

Defined class
Point
p.x
3
echo output
3

Documentation-backed illustration. Vim9 class support (+eval); class declarations occur only at script level; source code is prepared as point-demo.vim. :endclass appears in the complete source file. The class block defines Point; its default constructor creates p with x=3. Primary help: :endclass.

Sample buffer
vim9script
class Point
  var x: number = 3
endclass
var p = Point.new()
echo p.x
Cursor on line 1, column 1
Details & Vim help

End of a class declaration. 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. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.