Preview window on the bottom!

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Preview window on the bottom!

Karl Guertin

In poking around the more obscure areas of vim, I ran across the
preview window. I really like the concept and the integration with
omnicomplete, but I hate that it's at the top and shifts the entire
screen of text when it pops in and out. Getting it to the bottom is
simple enough:

function! PreviewDown()
   if !&previewwindow
       silent! wincmd P
   endif
   if &previewwindow
       silent! wincmd J
       silent! wincmd p
   endif
endf

and then in my .vimrc:

au BufWinEnter * call PreviewDown()

But there are a couple problems with this. The first is that it causes
the system vim in OS X 10.5 (7.0.234) to exit with status 1 all the
time (took forever to track that one down) and the second is that it
doesn't seem to work with all preview window uses (e.g. C-W { doesn't
seem to trigger ANY buf* au events). Is there a simpler way to get the
window to always show up on the bottom?

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Preview window on the bottom!

Tony Mechelynck

On 27/09/08 10:14, Karl Guertin wrote:

> In poking around the more obscure areas of vim, I ran across the
> preview window. I really like the concept and the integration with
> omnicomplete, but I hate that it's at the top and shifts the entire
> screen of text when it pops in and out. Getting it to the bottom is
> simple enough:
>
> function! PreviewDown()
>     if !&previewwindow
>         silent! wincmd P
>     endif
>     if&previewwindow
>         silent! wincmd J
>         silent! wincmd p
>     endif
> endf
>
> and then in my .vimrc:
>
> au BufWinEnter * call PreviewDown()
>
> But there are a couple problems with this. The first is that it causes
> the system vim in OS X 10.5 (7.0.234) to exit with status 1 all the
> time (took forever to track that one down) and the second is that it
> doesn't seem to work with all preview window uses (e.g. C-W { doesn't
> seem to trigger ANY buf* au events). Is there a simpler way to get the
> window to always show up on the bottom?

"Always", I'm not sure. "This time", it's easy, use the ":bo[tright]"
prefix:

        :bot ptag

Note that this prefix doesn't work with ":execute" or ":normal".


Best regards,
Tony.
--
Carperpetuation (kar' pur pet u a shun), n.:
        The act, when vacuuming, of running over a string at least a
dozen times, reaching over and picking it up, examining it, then
putting it back down to give the vacuum one more chance.
                -- Rich Hall, "Sniglets"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Preview window on the bottom!

John Little-4
In reply to this post by Karl Guertin



On Sep 27, 8:14 pm, "Karl Guertin" <[hidden email]> wrote:
> In poking around the more obscure areas of vim, I ran across the
> preview window. I really like the concept and the integration with
> omnicomplete, but I hate that it's at the top and shifts the entire
> screen of text when it pops in and out.

The tail script (http://www.vim.org/scripts/script.php?script_id=1714)
does this (opens a preview window at the bottom) by using "new" and
setting an autocmd BufWinEnter on the file to call a function that has
setlocal previewwindow (amongst a bunch of stuff).

Regards, John
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Preview window on the bottom!

Karl Guertin
In reply to this post by Tony Mechelynck

On Sat, Sep 27, 2008 at 2:16 AM, Tony Mechelynck
<[hidden email]> wrote:
> "Always", I'm not sure.

Thanks for the responses. I'll take that as a no then. I was hoping I
missed some config option somewhere. My autocommand works 90% of the
time (omni completion, other script stuff) and I don't do the others
often enough to be worth remapping every exception, that was more of a
complaint about the autocommand events not firing. I just wish I knew
why an (apparently bug free) autocommand is causing my vim to exit 1.
Guess I'll just tweak my source control editors to vim -u NORC and be
done with it.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---