sponsor Vim development Vim logo Vim Book Ad

basic Tip #55: previous buffer

 tip karma   Rating 84/33, Viewed by 2637 

created:   March 27, 2001 21:33      complexity:   basic
author:   [email protected]      as of Vim:   5.7

One of the keys to vim is buffer management. If I have to use another IDE that makes me click on a tab every time I want to look at another file I'm going to go postal.

So of course you know about :ls which lists all the current open buffers. This gets a little unweildly once you have a full project open so you can also use :b <any snipit of text> <tab> to complete to an open buffer. This is really nice because you can type any fragment of a file name and it will complete to the matching file. (i.e. RequestManager.java can be completed using "tma"<tab> or "req"<tab> or "r.java"<tab>).

Now for awhile I was also using :bn and :bp which jumps you to the next and previous buffer respectively. I found I was often frustrated because I wanted :bp to be the previous buffer I was in, not the previous buffer in the list. So (drum roll) the reason I wrote this tip was because of:

:b#

jump to the previous buffer you were in. Very very handy. The only thing nicer are tag, but that's a tip for another time.

:help buffers
:help bn
:help bp

If anybody knows where to get help on # in this context please add notes.

 rate this tip  Life Changing Helpful Unfulfilling 

<<View a Java Class File Decompiled thru Vim | how to avoid obliterating window layout >>

Additional Notes

[email protected], April 6, 2001 6:26
For explanaition of # magic see :help expand
Btw, see :help CTRL-^ to toggle buffers
fma to be found at cci.dk, June 14, 2001 6:42
This is roughly the same as :e# except for completion
See also help for  :_# and CTRL-^
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
    stats
Sponsored by Web Concept Group Inc. SourceForge.net Logo