Save session info to a file
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2Save session info to a file.
Prepared workspace
- Options
number enabled- Global mapping
<F6> → :set number!<CR>
Output file
- ExampleSession.vim
absent
Command entered · ready to apply
Prepared workspace
- Options
number enabled- Global mapping
<F6> → :set number!<CR>
Output file
- ExampleSession.vim
absent
Command line
- Typed text
:mksession ExampleSession.vim- Insertion offset
29
:mksession writes ExampleSession.vim. The files panel summarizes what the generated script restores; saving it does not close or restore the current session.
Prepared workspace
- Options
number enabled- Global mapping
<F6> → :set number!<CR>
Session script written
- Filename
ExampleSession.vim- Meaningful contents
edit alpha.txt; split beta.txt; restore alpha.txt focus; restore number and global <F6> mapping- Representation
summary; generated script includes version-dependent setup
Before & after
Before
Prepared workspace
- Options
number enabled- Global mapping
<F6> → :set number!<CR>
Output file
- ExampleSession.vim
absent
After
Prepared workspace
- Options
number enabled- Global mapping
<F6> → :set number!<CR>
Session script written
- Filename
ExampleSession.vim- Meaningful contents
edit alpha.txt; split beta.txt; restore alpha.txt focus; restore number and global <F6> mapping- Representation
summary; generated script includes version-dependent setup
Documentation-backed illustration. the example directory is writable and the target file does not exist; +mksession support; sessionoptions includes buffers,curdir,options,winsize. :mksession writes ExampleSession.vim. The files panel summarizes what the generated script restores; saving it does not close or restore the current session. Primary help: :mksession.
alphaCursor on line 1, column 1Details & Vim help
Save session info 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 :mks[ession] 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.