Question

Sometimes when I use vim, I need to change some local settings for certain buffers via setlocal. Later, when I save and restore a session with mksession and source, these settings are not saved and I need to setlocal them all again.

This is very inconvenient. So is there a way to keep local settings with a session?

Was it helpful?

Solution

Looks like you'll need to change the 'sessionoptions' value. From :h 'sessionoptions':

Changes the effect of the :mksession command. It is a comma separated list of words. Each word enables saving and restoring something:

localoptions options and mappings local to a window or buffer (not global values for local options)

Ergo:

:set sessionoptions+=localoptions

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top