Even the 5MB figure is actually overstating the case a bit. Much of vim’s running code overhead is in libc, libm, and other shared libraries (including internationalization/localization libraries for handling UTF-8 and so on. Your shell (bash, zsh, whatever) almost certainly shares most of the same libraries … so a couple of those megabytes are shared with just about every normal compiled library on your system.
Here’s a bit about vi (marginally about vim) which I wrote several years ago for a question on StackOverflow; people still come up to me, in person at conferences, to thank me for it:
here’s the tl;dr vi is a language for expression how you want to display and modify text on a terminal or in a terminal emulation window. It’s one of the most expressive languages purely dedicated to that task. Using it’s features every text processing utility and filter on your system can be easily used as though it were a “macro” or features of vi (including any awk, Perl, Python, Ruby or other scripts you write or download and install).