How do I make mksession restore globals and local options too?
:set sessionoptions+=globals,localoptions
If you rely on sessions for context switching, default :mksession can feel incomplete because some state does not come back.
:set sessionoptions+=globals,localoptions
If you rely on sessions for context switching, default :mksession can feel incomplete because some state does not come back.
:set viewoptions=folds,cursor,slash,unix
mkview and loadview are great for restoring editing context, but the default viewoptions can bring back more state than you actually want.
:Obsession
If you routinely work across many files, tabs, and split layouts, rebuilding your workspace after a restart is costly.
plugins #plugins #sessions #workflow #buffers-windows #productivity
:set sessionoptions-=curdir
When you restore a session with :source Session.
:set sessionoptions+=globals
By default, :mksession restores windows, buffers, and many editor states, but it skips most global variables.
`0
Vim automatically saves your cursor position when you exit, storing it as the 0 mark in the viminfo file (or shada file in Neovim).
:set sessionoptions
The sessionoptions option (abbreviated ssop) is a comma-separated list of flags that determine what :mksession stores in the session file.
buffers-windows #buffers-windows #config #workflow #sessions
'0
Pressing '0 in normal mode jumps to the exact cursor position in the most recently edited file, even after closing and reopening Vim.
:wviminfo / :rviminfo
Vim can persist register contents (including macros) across sessions using viminfo (Vim) or shada (Neovim).