Vim has the concept of buffer, a buffer can be just an open file. For example, to list all the open buffers type
The intention here is not to explain buffers, there is a lot of good sources for that (ex: http://vim.wikia.com/wiki/Vim_buffer_FAQ).
One of the Vim commands I use a lot is the
:b# to switch back to the last used buffer (the one you were before the actual open). This can be very useful, for example, if you are working with the application code in one buffer and the correspondent unit test in the other one (another great way to work with two related files is using the
:b# and pressing the enter every time can be really annoying. Here is a simple key map to help with this:
function SwitchBuffer() b# endfunction nmap <Tab> :call SwitchBuffer()<CR>
Put the code above in your
.vimrc file. Now every time you press
Tab in normal mode the buffer will switch.