How is it that VIM (when running) can display the contents of a file to the terminal, then (when closed) can take what was displayed back? There have been several applications I have made where I would have liked to implement this functionality… like when making a program with terminal graphics where the entire screen typically has to be updated when a single “object” moves.
Share
It’s your terminal that stores the old buffer, not Vim.
If you use XTerm emulation, Vim switches to the “alternate” terminal screen on startup. On exit, Vim switches back to the normal screen.
Terminfo strings at startup:
Terminfo strings at exit: