Quit sourcing a Vim script
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2Quit sourcing a Vim script.
Script runtime
- Load state
not sourced
Command entered · ready to apply
Script runtime
- Load state
not sourced
Command line
- Typed text
:source finish-demo.vim- Insertion offset
23
:finish appears in the complete source file. finish terminates this source file, so the assignment after it is never reached.
Script runtime
- g:stage
before- Sourcing
stopped at finish; final assignment skipped
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.
let g:stage = 'before'
finish
let g:stage = 'after'Cursor on line 1, column 1Details & 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.