*29.2*    The preview window

When you edit code that contains a function call, you need to use the correct
arguments.  To know what values to pass you can look at how the function is
defined.  The tags mechanism works very well for this.  Preferably the
definition is displayed in another window.  For this the preview window can be
used.
   To open a preview window to display the function "write_char": >

    :ptag write_char

Vim will open a window, and jumps to the tag "write_char".  Then it takes you
back to the original position.  Thus you can continue typing without the need
to use a CTRL-W command.
   If the name of a function appears in the text, you can get its definition
in the preview window with: >

    CTRL-W }

There is a script that automatically displays the text where the word under
the cursor was defined.  See |CursorHold-example|.

To close the preview window use this command: >

    :pclose

To edit a specific file in the preview window, use ":pedit".  This can be
useful to edit a header file, for example: >

    :pedit defs.h

Finally, ":psearch" can be used to find a word in the current file and any
included files and display the match in the preview window.  This is
especially useful when using library functions, for which you do not have a
tags file.  Example: >

    :psearch popen

This will show the "stdio.h" file in the preview window, with the function
prototype for popen():

    FILE    *popen __P((const char *, const char *)); ~

You can specify the height of the preview window, when it is opened, with the
'previewheight' option.

posted on 2014-04-11 23:20  linghuchong0605  阅读(572)  评论(0编辑  收藏  举报