5 Latex Completion

5.1 Latex-Suite completion example
5.2 Latex-Suite \ref completion
5.3 Latex-Suite \cite completion
5.4 Latex-Suite filename completion
5.5 Custom command completion

Latex-Suite provides an easy way to insert references to labels and bibliographic entries and also provide filename arguments to commands such as \includegraphics. Although the completion capabilities are very diverse, Latex-Suite only uses a single key (<F9> by default) to do all of it. Pressing the <F9> key does different things based on where you are located. Latex-Suite tries to guess what you might be trying to complete at the location where you pressed <F9>. For example, pressing <F9> when you are within a \ref command will try to list the \label's in the present directory. Pressing it when you are in a \cite command will list bibliography keys. Latex-Suite also recognizes commands which need a file name argument and will put up an explorer window for you to choose a filename.

Before you start with Latex-Suite's completion function...

All of Latex-Suite's completion capabilities depend on a external program being available on your system which can search through a number of files for a reg-exp pattern. On *nix systems, the pre-installed grep utility is more than adequate. Most windows systems come with a utility findstr, but that has proven to be very inadequate (for one, it does not have an option to force the file name to be displayed when searching through a single file). Your best bet is to install cygwin, but if you think that's overkill, you can search for a windows implementation of GNU grep. (Latex-Suite testing on windows has been done with cygwin's port of GNU grep).

Once you have a grep program installed, you need to set the 'grepprg' option for vim. Make sure you use a setting which forces the program to display file names even when you are searching through a single file. For GNU grep, the syntax is

set grepprg=grep\ -nH\ \$*