Is there a way to tell Vim what to do every time I’m about to close a file? Specifically I am asking because I don’t want to make a call to :mkview all the time, especially since I forget it most of the time…
So can I tell Vim to call :loadview when I open a file and :mkview when I close it?
Is there a way to tell Vim what to do every time I’m about
Share
The best answers are often in Vim’s help, if you know what to search for. In this case, one possible solution is at
:h :loadview:You can modify this to suit your own needs. To make it apply to all filetypes, use
*instead of*.c. To make this happen at Vim startup and exit, use the eventsVimLeaveandVimEnterinstead ofBufWinLeaveandBufWinEnter.