How to navigate Vim file history
vim
Solution
The file A, B and C are called "buffers" in Vim parlance. What you want is the ability to jump directly from buffer to buffer or the ability to select the buffer you want to jump to.
Jumping from one buffer to another is easy. It's done with the `:b` command or its cousins:
:b filename<CR> " jump directly to the named buffer
:b fil<tab> " select from <tab>-navigable menu if
" more than one match, completes the
" filename otherwise
:b <tab> " select from <tab>-navigable menu
:2b " go to buffer number 2
:bfirst<CR> (or :bf) " self-descriptive
:blast<CR> (or :bl) " self-descriptive
:bnext<CR> (or :bn) " self-descriptive
:bprevious<CR> (or :bp) " self-descriptive
Selecting a buffer from a list is also easy: `:ls<CR>` shows a numbered list of buffers and waits for a command. At that point, you type `:b <number><CR>` or `:<number>b<CR>` to jump to the selected buffer. You can add the following mapping to your `~/.vimrc` to make the whole process quicker:
nnoremap <leader>b :ls<CR>:b<space>
There is also a rather large number of buffer switching plugins at your disposal (the rest of the page is also full of interesting info).
I use CtrlP, which is not listed, when I can and the mapping above when I can't.
Problem
I'm using Vim 7.3 with the MRU plugin. With this plugin, when you type `:MRU` you see a new window with the most recent used files. That's cool, but I want something more specfic than that: Let's say that I'm working with just one window. I first open file A, then file B, then file C. Now that I'm currently on file C, I want to go back to file B and then back to file A with a keystroke, just like a back button on a browser history. And I want to do the same to move forward, from file A back to file B and finally back to file C, like I'm playing with a browser history. How can I do that?