Vim Recall繁體中文

Quit sourcing a Vim script

:finish

Example

Normal 0 / 2

Quit sourcing a Vim script.

Script runtime

Load state
not sourced
Before & after

Before

Script runtime

Load state
not sourced

After

Script runtime

g:stage
before
Sourcing
stopped at finish; final assignment skipped

Documentation-backed illustration. Vim has +eval and supports the displayed script syntax; source code is prepared as finish-demo.vim. :finish appears in the complete source file. finish terminates this source file, so the assignment after it is never reached. Primary help: :finish.

Sample buffer
let g:stage = 'before'
finish
let g:stage = 'after'
Cursor on line 1, column 1
Details & Vim help

Quit sourcing a Vim script. 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 :fini[sh] 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.