Switching between buffers (most recently used buffer list)

236 views
Skip to first unread message

sas...@gmail.com

unread,
Aug 17, 2008, 6:52:40 PM8/17/08
to vim_use
Hi

As a long time VStudio user I've found it hard to figure out the best
way to switch from the current buffer to a previously worked on
buffer. VStudio keeps a history list of the most recently used buffers
and hitting ctrl-tab moves to the previous buffer in that list. For
example if I have 3 buffers, A B and C open and the * in the following
(A*,B,C) denotes the buffer that has the input focus then hitting ctrl-
tab will rearange the list to look like: B*, A,C. This makes it easy
to use ctrl-tab to alternate between A and B. If I want to view C I
hit ctrl-tab twice and the list is now C*,B,A. This most recently used
list is very useful because I tend to work with the same set of
buffers for a period of time and it lets me quickly move between them.
The jumplists almost do this but they also record points within the
same buffer, which makes them awkward to use. :bn and :bp don't do
what VStudio does (although initially I thought they might). The
closest thing I've found that matches VStudio's buffer history
behavior is ctrl-^ which is the 'alternate' file except that this
isn't the same as a most recently used history list that VStudio
implements.

Charles E. Campbell, Jr.

unread,
Aug 17, 2008, 7:54:33 PM8/17/08
to vim...@googlegroups.com
Have you looked at vim.sf.net? Without trying too hard, I found mru.vim
(Most Recently Used Files):
http://vim.sourceforge.net/scripts/script.php?script_id=521

Regards,
Chip Campbell

John Beckett

unread,
Aug 17, 2008, 11:29:39 PM8/17/08
to vim...@googlegroups.com
sashang wrote:
> As a long time VStudio user I've found it hard to figure out
> the best way to switch from the current buffer to a
> previously worked on buffer. VStudio keeps a history list of
> the most recently used buffers and hitting ctrl-tab moves to
> the previous buffer in that list.

Try the info in this tip:
http://vim.wikia.com/wiki/Easier_buffer_switching

People who are not used to Visual Studio have no idea how clever that Ctrl-Tab stuff
is. I've never seen a decent implementation in Vim, but once you've got on top of
the above tip you probably will be ok.

John

Richard Hartmann

unread,
Aug 18, 2008, 6:10:32 AM8/18/08
to vim...@googlegroups.com
On Mon, Aug 18, 2008 at 05:29, John Beckett <johnb....@gmail.com> wrote:

> People who are not used to Visual Studio have no idea how clever that Ctrl-Tab stuff
> is. I've never seen a decent implementation in Vim, but once you've got on top of
> the above tip you probably will be ok.

Actually, the 'alt-foo affects windows, ctrl-foo affects sub-windows'
thing has been
in Windows since at least 3.1. I agree that this is one of the few
things they did
right :)
KDE uses CTRL-TAB for managing virtual desktops btw, so you can not use that
hint with default settings.


Richard

Andy Wokula

unread,
Aug 18, 2008, 8:06:51 AM8/18/08
to vim...@googlegroups.com

Anton Sharonov

unread,
Aug 18, 2008, 6:00:11 PM8/18/08
to vim...@googlegroups.com
Andy, it's really cool ! Thanks a lot !

2008/8/18, Andy Wokula <anw...@yahoo.de>:

Tim Harper

unread,
Aug 18, 2008, 6:21:45 PM8/18/08
to vim...@googlegroups.com
I'll put in a plug for fuzzy finder - the FuzzyFindMRU command is
sweet action.

Tim

Anton Sharonov

unread,
Oct 29, 2008, 4:43:47 PM10/29/08
to vim...@googlegroups.com
After some happy time of staying with Andy's bufmru.vim plugin, I
must say it is really convenient.

But there is always some room for improvements, isn't it ? :)
Just one enhancement idea: together with displaying the buffer
name in the status line, it would be great to really switch the
buffers temporarily - so one can decide faster depends on how
this buffer looks like - to stay in it or to switch further.
Buffer name in status line is a bit hard IMO to concentrate on it
enough to quickly decide, either this is a proper buffer, which I
need... What is the opinion of another bufmru.vim users about
that ?

And thanks one more time for the excellent plugin, Andy :)

Anton.


2008/8/18, Tim Harper <timch...@gmail.com>:

Richard Hartmann

unread,
Nov 6, 2008, 4:39:01 AM11/6/08
to vim...@googlegroups.com
On Wed, Oct 29, 2008 at 21:43, Anton Sharonov <anton.s...@gmail.com> wrote:

> Just one enhancement idea: together with displaying the buffer
> name in the status line, it would be great to really switch the
> buffers temporarily - so one can decide faster depends on how
> this buffer looks like - to stay in it or to switch further.

Sounds like a good idea. But does this scale with large files
and/or complex highlighting (if that is redone), etc?

I honestly don't know, as the maximum I use Vim for in this
regard is splitting. Everything else, I do with either screen
or Konsole tabs. (Well, I sometimes update a few files at
once, but :wn is the extent of what I use ;)


Richard

Anton Sharonov

unread,
Nov 6, 2008, 10:38:38 AM11/6/08
to Richard Hartmann
Guten Tag Richard Hartmann,

am Donnerstag, 06. November 2008 um 10:39 schrieben Sie:

>> Just one enhancement idea: together with displaying the buffer
>> name in the status line, it would be great to really switch the
>> buffers temporarily - so one can decide faster depends on how
>> this buffer looks like - to stay in it or to switch further.

> Sounds like a good idea. But does this scale with large files
> and/or complex highlighting (if that is redone), etc?

> I honestly don't know, as the maximum I use Vim for in this
> regard is splitting. Everything else, I do with either screen
> or Konsole tabs. (Well, I sometimes update a few files at
> once, but :wn is the extent of what I use ;)

I have already made a patch for this displaying buffers, but not yet
adopted to "unpublished" new version of bufmru.vim from Andy.

--
Anton

Anton Sharonov

unread,
Mar 11, 2009, 3:57:32 AM3/11/09
to Richard Hartmann
> > > sas...@gmail.com schrieb:
> > > > Hi
> > > >
> > > > As a long time VStudio user I've found it hard to figure
> > > > out the best way to switch from the current buffer to a
> > > > previously worked on buffer. VStudio keeps a history list
> > > > of the most recently used buffers and hitting ctrl-tab
> > > > moves to the previous buffer in that list. For example if
> > > > I have 3 buffers, A B and C open and the * in the
> > > > following (A*,B,C) denotes the buffer that has the input
> > > > focus then hitting ctrl- tab will rearange the list to
> > > > look like: B*, A,C. This makes it easy to use ctrl-tab to
> > > > alternate between A and B. If I want to view C I hit
> > > > ctrl-tab twice and the list is now C*,B,A. This most
> > > > recently used list is very useful because I tend to work
> > > > with the same set of buffers for a period of time and it
> > > > lets me quickly move between them. The jumplists almost
> > > > do this but they also record points within the same
> > > > buffer, which makes them awkward to use. :bn and :bp
> > > > don't do what VStudio does (although initially I thought
> > > > they might). The closest thing I've found that matches
> > > > VStudio's buffer history behavior is ctrl-^ which is the
> > > > 'alternate' file except that this isn't the same as a
> > > > most recently used history list that VStudio implements.
> > >
> >
> > Andy Wokula wrote:
> > > My suggestion:
> > > http://www.vim.org/scripts/script.php?script_id=2346

>
> Anton Sharonov wrote:
> > Just one enhancement idea: together with displaying the
> > buffer name in the status line, it would be great to really
> > switch the buffers temporarily - so one can decide faster
> > depends on how this buffer looks like - to stay in it or to
> > switch further.

For those who is interested, new version of bufmru.vim [1] is
published by Andy. It's now allows to switch buffers "visually"
if g:bufmru_splashbufs is set to 1.

--
Anton
[1] bufmru.vim by Andy Wokula
http://www.vim.org/scripts/script.php?script_id=2346

Reply all
Reply to author
Forward
0 new messages