If you did not understand my description I am happy to give further details.
Thank you for your attention,
Mobi
You can extend your keyboard shortcut so that it redirects the output
of :messages to a register, then open a new window or tab, then paste
the content of that register.
:redir @a
:messages
:redir END
<open a new window or tab, then paste content of "a>
nazri
And then you can hit '/' and voila! Incremental search! Combine this
with a customized syntax highlight of your liking... ah the
possibilities are endless with vim!
nazri.
... or save the current window layout with winrestcmd() and restore it afterwards.
-- ingo
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.
To implement such a thing in Vimscript, save the current window layout via
let save_layout = winrestcmd()
then :split open the scratch buffer. Inside that special buffer, you often set
up mappings to acknowledge and close that buffer, e.g.
nmap <CR> :let selected_line = getline('.')<Bar>close<Bar>silent! execute
save_layout<CR>
but you could also setup an :autocmd on closing / leaving the scratch buffer to
restore the layout. With the autocmd, you are able to close the scratch buffer
with any built-in Vim command like CTRL-W_c.
Unless I misunderstood your use case, winrestcmd() (and maybe also
winsaveview()) is all you need to implement temporary windows that restore the
window layout.
-- regards, ingo
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.
> 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
What do you mean, "you don't have a tab-bed window?" If you have Vim
version 7, compiled with +windows (i.e., with the split-windows
capability), then it also has the capability to handle several "tab
pages", i.e., several "layouts" of one of more split-windows each, in a
single instance of the executable. See ":help tabpage.txt" for details.
For the use case discussed on this thread, you can open a window on a
different tabpage with ":tabnew", do anything you want there, then close
it with ":tabclose!" and you're back to wherever you were before, with
your window layout undisturbed. Depending how your script works (see
also ":help :silent" and ":help :redir"), it could even be possible to
open and close that auxiliary tab page without anyone the wiser, but I
confess I haven't tried it.
Best regards,
Tony.
--
Experience is what causes a person to make new mistakes instead of old
ones.
Yes, there are tabs. Vim's tabpages work both in the console and gui
builds of Vim.
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jame...@jamessan.com>
builds of Vim.