Save view of current window to a file
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2Save view of current window to a file.
Current window view
- File
chapter.txt- Cursor
line 2, column 1- Fold
lines 2–3 closed- viewoptions
folds,cursor
Files
- chapter.view.vim
absent
Command entered · ready to apply
Current window view
- File
chapter.txt- Cursor
line 2, column 1- Fold
lines 2–3 closed- viewoptions
folds,cursor
Files
- chapter.view.vim
absent
Writes a script restoring this window's file, fold and cursor. An explicit file name adds an edit command; source chapter.view.vim later restores it.
Current window view
- File
chapter.txt- Cursor
line 2, column 1- Fold
lines 2–3 closed- viewoptions
folds,cursor
Files
- chapter.view.vim
created: restore chapter.txt, closed fold 2–3, cursor line 2
Before & after
Before
Current window view
- File
chapter.txt- Cursor
line 2, column 1- Fold
lines 2–3 closed- viewoptions
folds,cursor
Files
- chapter.view.vim
absent
After
Current window view
- File
chapter.txt- Cursor
line 2, column 1- Fold
lines 2–3 closed- viewoptions
folds,cursor
Files
- chapter.view.vim
created: restore chapter.txt, closed fold 2–3, cursor line 2
Subject: :mkview. Documentation-backed illustration; assumes named chapter.txt, manual fold 2–3, viewoptions=folds,cursor, writable absent output file; not replay-verified. Writes a script restoring this window's file, fold and cursor. An explicit file name adds an edit command; source chapter.view.vim later restores it.
chapter one
chapter two
chapter threeCursor on line 2, column 1Details & Vim help
Save view of current window to a file. 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 :mkvie[w] 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.