# Getting \cite{} autocompletion to work in gvim with latex-suite on windows 7

I am using gvim (latest version) with latex-suite (latest version) on Windows 7 32 bits. This is a fresh install from my previous Ubuntu setup. Everything runs fine except for cite autocompletion, and I can't figure out why.

For instance, I want to cite an article whose bib code is "aumann". Usually, I would type \cite{au} and then press f9 to get a split-window with a list of different citing options. Except this split window does not open. In fact, something does happen when I press f9. The whole gvim window is doing something really quick (I cannot see what), then it goes back to insert mode. Probably it might just be a matter of a configuration of the f9 key.

However, I can compile this .tex file with any reference compiling correctly. It is just that f9 does not open this very time-saving citation split window.

I would appreciate any input on this matter. I suppose I am not the only one with this problem as my setup is standard.

-
Do you have the same problem when using \ref{} F9? If not, it could be an issue with the entries in your bibliography as described in http://ubuntuforums.org/showthread.php?t=952911 –  cmhughes Apr 20 '12 at 12:22
Thank you for your suggestion! The problem was that I did not have a PATH variable which allowed grep to be reached by a command. Now that's done, another problem came up, namely that pressing enter to select the reference closes the two split windows, but does not add the reference code. Do you have any clue regarding this issue? –  wiwh Apr 20 '12 at 14:08
I tried to press < f9 > after \ref{ and there is also an error: ''C:' is not recognized as an internal or external command. The two errors might be correlated. Maybe it is of some help? –  wiwh Apr 20 '12 at 14:27

latex-suite requires grep to be installed on your system, and it must be reachable through the search PATH. You can get a Windows version here If it is not available, vim just flickers when pressing F9 but doesn't open the completion window. Also check the grepprg setting in your .vimrc file which should be

set grepprg=grep\ -nH\ $*  according to the documentation of latex-suite. - Thank you so much for your answer, Martin! As you suggested, grep was not reachable through the PATH. To make it available, I right click on my computer -> properties -> Advanced System Settings -> Environment Variables. I added one named PATH and gave it the value: C:/ Program Files/GnuWin32/bin which is the default installation folder containing the binary files of grep. Now, the two usual windows pop up in split when I press < f9 > but when I press < enter > to select the desired reference, the appropriate reference code is not printed. It is left blank. Is it a known issue? Thank you! – wiwh Apr 20 '12 at 13:56 @wiwh: You're welcome. Do you have python 2.7 installed on your system? As far as I know, the completion functionality only works properly if you either use a vim version with python support enabled, or have a working python 2.7 available on the command-line. Older and newer python versions probably won't work. – Martin Apr 20 '12 at 19:06 After some google search, I found this very answer to be the solution to my problem! But anyway, your precise answers proved to be of great help! Thanks again. The whole process to make things work is now listed on my comment below. – wiwh Apr 20 '12 at 19:17 Thanks to the two comments above and some google search, I finally found a way to make cite autocompletion work. For Windows users out there, I have compiled the whole process: 1 - As Martin mentioned in one of the comments above, latex-suite requires grep to be installed on your system. You can get a Windows version here. Remember the directory of installation. If it is not available, vim just flickers when pressing F9 but doesn't open the completion window. Also check the grepprg setting in your .vimrc file which should be set grepprg=grep\ -nH\$*


according to the documentation of latex-suite. Just make sure to include this on a line in your .vimrc file.

2 - Once grep has been installed, you have to make it reachable via the windows environment variable PATH. (in words, grep will thereafter be able to be run with a command-line). To do so, right click on computer -> properties -> Advanced System Settings -> Environment Variables.

2.a - If there is already a PATH variable, edit it. At the beginning of the code, add C:/Program Files/GnuWin32/bin; which is the default installation folder containing the binary files of grep. If you installed it in another directory, choose the complete path to that directory. Use forward slash, not backslash. Do not forget the ; at the end, which will separate the grep path to the others already present in the PATH variable.

2.b - If there is no PATH variable, just create a new variable and name it PATH. Give it the value: C:/Program Files/GnuWin32/bin which is the default installation folder containing the binary files of grep. If you installed it in another directory, choose the complete path to that directory. Use forward slash, not backslash.

Save and quit.

3- Try out if this helped things out. On my setup, I had the list of the sources popping in a split window, but when I pressed enter, the source code was not filled in. The reason was that I did not have a proper Python version. If you have the same problem, go to point 4.

4 - On my setup, I believe vim used version 3.2.3 of Python. This version is too recent and not compatible with vim. Go here and download Python 2.7.3. Install it. On my setup, it did the trick without further settings. Now I can happily use the cite and ref autocompletion.

Thank you all for your help! I hope this post clarifies the issue and provides a useful solution!

-