John,

Doesn't CTRL-O do this for you? See

:help CTRL-O

David

-----Original Message-----
From: John Orr [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 01, 2007 4:12 AM
To: Michael Henry
Cc: [email protected]
Subject: Re: Minor fix for Vim Tip #1078 (Closing buffer without closing
window)

Clearly lots of us have solved this problem in various ways.
My take on it was that, for each window in your vim session, I wanted a
memory of which buffers had been displayed there -
almost like a "back" button in a web browser.
When you close a buffer, it would jump back to the previous buffer for
that particular window (repeatedly) -
so you could open a file, "gf" to another file, "gf" to another file etc
- then step backwards, closing them as you go, 
back to your first file (or the unnamed file if you go one too far - but
there's an undo function to fix that :)

http://www.vim.org/scripts/script.php?script_id=1147 if you're
interested.

John

On Tuesday 01 May 2007 10:18, Michael Henry wrote:
> All,
> 
> Vim Tip #1078 ("Best way to close (delete) buffer without closing its 
> window") is pretty useful.  In the version shown on the tip page[1],
it 
> doesn't keep your cursor in the window you are trying to preserve.  I 
> think the following line is supposed to serve that purpose:
> 
>      execute "normal " . g:kwbdWinNum . ""
> 
> The final pair of double-quotes are likely not supposed to be empty.
> 
> If you replace the line above with the following line, the active
window 
> will be preserved:
> 
>      execute g:kwbdWinNum "wincmd w"
> 
> I would have posted a comment on the tip, but comments are currently 
> disabled due to spam considerations.
> 
> As a side note, is there hope for re-enabling the comment feature?
I've 
> found that many of the scripts have valuable comments, sometimes 
> containing bug fixes, sometimes pointing to similar or complementary 
> scripts, etc.
> 
> Thanks,
> Michael Henry
> 
> [1]: http://www.vim.org/tips/tip.php?tip_id=1078
> 
> 

Reply via email to