4 ms·
wq writes the current file and closes the current window (which quits vim if you happen to be on the last window). The command to close the current buffer is :b
by alex_smart 6y ago
wq writes the current file and closes the current window (which quits vim if you happen to be on the last window). The command to close the current buffer is :bd(elete).
If you want to return to the previous file without closing the new file, you can just use :bp(rev) so that the new file also stays in memory.
Relevant man page is available at :help buffers.
>Also curious if there is a way to open the file as a new split screen rather than replacing the entire window?
CTRL-W f
Another remark: vim's shortcuts are organized in a way that you are often able to guess what the correct shortcut should be. CTRL-W is the common prefix for commands regarding split windows CTRL-W v/s for splits, CTRL-W CTRL-W cycle through windows. So naturally you can guess that CTRL-W f should be open file in split and CTRL-W ] should be jump to definition in split.