Thread: [Vim-latex-devel] bug in \cite-completion of 1.5
Brought to you by:
srinathava,
tmaas
From: Lasse K. <las...@gm...> - 2003-12-16 22:22:45
Attachments:
texviewer.vim.patch
|
Greetings, I am new to this list and did not have time to study the archive, so maybe this issue has been discussed before. This mail and the attached patch is published in the hope that it will be usefull. I found the completion for \cite not to work correctly in version 1.5 (in fact the first version I tried). It seemed like the prefix 'pre' as in \cite{pre<F9> was not honored and the insertion of the chosen bibtex-key did not work. I made a brute-force correction to these problems, resulting in a version of texviewer.vim that works ok for me now. A patch is attached. Please use with caution, since everything I know about scripting in vim is what I learned in about the last 60 minutes from trying to track down the errors encountered. -- Lasse Kliemann <http://plastictree.net> |
From: Srinath A. <sr...@fa...> - 2003-12-16 23:47:36
|
On Wed, 17 Dec 2003, Lasse Kliemann wrote: > I found the completion for \cite not to work correctly in version 1.5 > (in fact the first version I tried). It seemed like the prefix 'pre' as > in \cite{pre<F9> was not honored and the insertion of the chosen > bibtex-key did not work. > > I made a brute-force correction to these problems, resulting in a > version of texviewer.vim that works ok for me now. A patch is attached. > Please use with caution, since everything I know about scripting in vim > is what I learned in about the last 60 minutes from trying to track down > the errors encountered. > I could reproduce the problem too. I made a different patch to solve this problem. Its now in CVS. I made a release with this patch. Please try out the latest developement version. (Don't worry, its as stable as 1.5). Srinath |
From: Lasse K. <las...@gm...> - 2003-12-17 00:43:07
Attachments:
texviewer.vim.patch.2
|
* Srinath Avadhanula writes: > > On Wed, 17 Dec 2003, Lasse Kliemann wrote: > > > I found the completion for \cite not to work correctly in version > > 1.5 (in fact the first version I tried). It seemed like the prefix > > 'pre' as in \cite{pre<F9> was not honored and the insertion of the > > chosen bibtex-key did not work. > > > > I made a brute-force correction to these problems, resulting in a > > version of texviewer.vim that works ok for me now. A patch is > > attached. Please use with caution, since everything I know about > > scripting in vim is what I learned in about the last 60 minutes from > > trying to track down the errors encountered. > > I could reproduce the problem too. I made a different patch to solve > this problem. Its now in CVS. I made a release with this patch. Please > try out the latest developement version. (Don't worry, its as stable > as 1.5). The first problem is corrected by your changes, but the insertion of the completed word still did not work for me. I could fix it by a similar measure as before, patch is attached. It must be something with that regexp, and since I am no expert on these, I can only offer a likely temporary fix. -- Lasse Kliemann <http://plastictree.net> |
From: Lasse K. <las...@gm...> - 2003-12-17 00:52:39
|
* I wrote: > ... but the insertion of the completed word still did not work for me. > I could fix it by a similar measure as before, patch is attached. It > must be something with that regexp, and since I am no expert on these, > I can only offer a likely temporary fix. I attached the following patch: > --- /home/snyder/tmp/ftplugin/tex/texviewer.vim 2003-12-17 00:42:47.000000000 +0100 > +++ ftplugin/tex/texviewer.vim 2003-12-17 02:37:52.000000000 +0100 > @@ -332,7 +332,8 @@ > if getline('.') =~ '\\bibitem{' > let bibkey = matchstr(getline('.'), '\\bibitem{\zs.\{-}\ze}') > else > - let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze,') > + " let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze,') > + let bibkey = matchstr(getline('.'), '{\(.*$\)') > endif > let completeword = strpart(bibkey, strlen(s:prefix)) To make that really work, change that last line to: let completeword = strpart(bibkey, strlen(s:prefix)+1) But I am sure, there is a better solution to this all. -- Lasse Kliemann <http://plastictree.net> |
From: Srinath A. <sr...@fa...> - 2003-12-17 01:05:11
|
Hi Lasse, On Wed, 17 Dec 2003, Lasse Kliemann wrote: > > I could reproduce the problem too. I made a different patch to solve > > this problem. Its now in CVS. I made a release with this patch. Please > > try out the latest developement version. (Don't worry, its as stable > > as 1.5). > > The first problem is corrected by your changes, but the insertion of the > completed word still did not work for me. I could fix it by a similar > measure as before, patch is attached. It must be something with that > regexp, and since I am no expert on these, I can only offer a likely > temporary fix. Could you please describe your problem a bit more? For example, what was expected to happen and what really happened. It will help if you tell us the line containing the \ref command and also the line containing the \bibitem command so I can reproduce it here... As it stands, I am not really sure what the patch is supposed to accomplish. According to me, the following patch is somewhat more safe. Could you try it out and let me know. Actually, I have _no_ idea why Mikolaj used a comma "," in that last regexp there. Mikolaj? I would have preferred just '{\zs.*\ze' as Lasse has suggested, but maybe the comma is necessary in some cases? Srinath Index: texviewer.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/texviewer.vim,v retrieving revision 1.36 diff -c -r1.36 texviewer.vim *** texviewer.vim 16 Dec 2003 23:41:10 -0000 1.36 --- texviewer.vim 17 Dec 2003 01:02:12 -0000 *************** *** 332,338 **** if getline('.') =~ '\\bibitem{' let bibkey = matchstr(getline('.'), '\\bibitem{\zs.\{-}\ze}') else ! let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze,') endif let completeword = strpart(bibkey, strlen(s:prefix)) --- 332,338 ---- if getline('.') =~ '\\bibitem{' let bibkey = matchstr(getline('.'), '\\bibitem{\zs.\{-}\ze}') else ! let bibkey = matchstr(getline('.'), '{\zs.\{-}\ze\(,\|$\)') endif let completeword = strpart(bibkey, strlen(s:prefix)) |
From: Lasse K. <las...@gm...> - 2003-12-17 01:51:38
|
* Srinath Avadhanula writes: > > On Wed, 17 Dec 2003, Lasse Kliemann wrote: > > > > I could reproduce the problem too. I made a different patch to > > > solve this problem. Its now in CVS. I made a release with this > > > patch. Please try out the latest developement version. (Don't > > > worry, its as stable as 1.5). > > > > The first problem is corrected by your changes, but the insertion of > > the completed word still did not work for me. I could fix it by a > > similar measure as before, patch is attached. It must be something > > with that regexp, and since I am no expert on these, I can only > > offer a likely temporary fix. > > Could you please describe your problem a bit more? For example, what > was expected to happen and what really happened. It will help if you > tell us the line containing the \ref command and also the line > containing the \bibitem command so I can reproduce it here... I type: \cite{k<F9> and then chose by pressing ENTER the entry from the list in the [Error List] window corresponding to the following entry in the .bib file: @article{kch-ace-02 , author = KorenY #and# CarmelL #and# HarelD , title = "ACE: A Multiscale Eigenvector Computation for Drawing Huge Graphs" , year = 2002 } It leaves me with the line: \cite{k} instead of \cite{kch-ace-02} > According to me, the following patch is somewhat more safe. Could you > try it out and let me know. Yes, it works for me. Thanks! -- Lasse Kliemann <http://plastictree.net> |