When you enter vim, it \"clears\" the screen. Upon exiting, it \"restores\" the original contents.
I understand one can use \\x1b[2J
to clear the consol
Regarding the answer by @Keith Thompson — not exactly:
smcup
and rmcup
automatically. Rather, it is a termcap application. It follows a convention used by most (not all) termcap applications. There are some implementations of vi
which do not for instance (on IRIX64 perhaps).r
in rmcup
means "reset" (and m
means "mode"). set/reset have different connotations from save/restore; with the latter the user is led to believe that the values can be stacked up.