On 11-Jul-09 19:07, mobi phil wrote:
> Your use case sounds like "scratch buffers", which are temporarily
> opened by a
> mapping, you navigate in it, then often select an entry by hitting
> <Return>,
> which then closes the scratch buffer and returns to the original
> window. Many
> plugins (project.vim, taglist.vim) use this approach to emulate an IDE's
> sidebar, task list, etc. Vim's built-in command-line window (q:) and
> quickfix
> window (:copen) are like that, too.
>
>
> Thanks for your quick answer.
> Indeed there is always a workaround. However if you look at the help of
> the winrestcmd function it says ... "only works properly if..."
Well, you also have to properly quote the caveat:
Only works properly when no windows are opened or closed and the current
window and tab page is unchanged.
That's why in my example, I first :close'd the scratch buffer (restoring the
previous number of windows and jumping back to the previous window, thus
meeting
the preconditions), and only then restored the window sizes. Trust me, if you
stick to the rules, it all works fine.
> Please do not take it as an offense, but if I would follow your
> reasoning practically the functionality of the lists (:map, :clist,
> :command, :tags etc.) they all could be implemented by the scratch
> buffers/windows, given that a function provides their content. The
> existence of the lists, and the way they are displayed tell me that they
> had to have a reason to be implemented as they are. And they are
> unbelievable useful. Just a simple example, when I have several
> files/buffers open, just doing :ls, and then execute :b or other
> commands on the buffers, I need the list of the buffers just for the
> short moment I take a decision/fork my workflow. If now I had to write a
> script to open the scratch buffer, then close it etc. etc. hm... much
> less people would use such feature/pattern. The pluggins you mentioned
> like tags.vim, projects.vim, could alse benefit be much more usefull, if
> they could be opened for the short period of the need (to select sthg.),
> etc...
> anyway... I do not want to give the impression that I am blowing against
> the wind... I will look at the code, if somebody wants to help, that is
> welcome... Once implemented, I will list 100 use cases, where it will
> improve everyday life experience with vim :)
So you seem intent on implementing generic functionality for lists / temporary
windows. Fine, I'm looking forward to it. I actually remember one occasion when
I wanted to "tune" the output of the :tags command, but would have to emulate a
lot of built-in functionality.
By explaining what can be done today (with scratch buffers), I simply want to
avoid frustration on your side in case your enhancement is later rejected
because it can already be done with Vimscript. (Cp. :help design-goals)
On the other hand, if your enhancement really improves usability and offers
totally new ways to customize and use Vim, I'm sure I'll love that new feature.
I sincerely wish you good luck and success in improving Vim!
-- ingo
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---