Jumping back and forth
Most of the time when we’re working with multiple files, we’re jumping back and forth between just two files at any given time. For example, we might be switching between two source code files, or we might be switching between a LaTeX document and a bibliography. Vim has a tool that can help us here.
It’s called the “alternate file”. When you switch buffers, Vim keeps track of the buffer you were in last so that we can switch back to it quickly. The keymap for jumping to the alternate file is <C-^> — that’s hitting the 6 key on your keyboard while holding control.
Work through the checklist below. foo.txt is already in your buffer list, so jump straight to it with :b — that switch makes this file the alternate. Then use <C-^> to flip between the two — no command line needed at all.