[Vim-latex-cvs] vimfiles/ftplugin/tex texviewer.vim,1.35,1.36
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2003-12-16 23:41:15
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/tex
In directory sc8-pr-cvs1:/tmp/cvs-serv4145
Modified Files:
texviewer.vim
Log Message:
Bug: \cite completion did not work. The prefix was not honored and
therefore all the matches would be shown and moreover the text would
not be inserted properly.
Cause: We had used the pattern::
let s:prefix = matchstr(s:prefix, '\([^,]\+,\)\+\zs\([^,]\+\)\ze$')
to modify the prefix. However, this only succeeds when there are
more than 1 items in the \cite. i.e, \cite{key1,pre. s:prefix
becomes empty if we do try to complete just \cite{pre
Fix: Change the prefix to::
let s:prefix = matchstr(s:prefix, '\([^,]\+,\)*\zs\([^,]\+\)\ze$')
Index: texviewer.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/tex/texviewer.vim,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** texviewer.vim 15 Dec 2003 00:55:26 -0000 1.35
--- texviewer.vim 16 Dec 2003 23:41:10 -0000 1.36
***************
*** 59,63 ****
let s:curfile = expand("%:p")
let s:curline = strpart(getline('.'), col('.') - 40, 40)
! let s:prefix = matchstr(s:curline, '.*{\zs.\{-}$')
" a command is of the type
" \psfig[option=value]{figure=}
--- 59,63 ----
let s:curfile = expand("%:p")
let s:curline = strpart(getline('.'), col('.') - 40, 40)
! let s:prefix = matchstr(s:curline, '.*{\zs.\{-}\(}\|$\)')
" a command is of the type
" \psfig[option=value]{figure=}
***************
*** 87,96 ****
" TODO: Is there a way to clear the search-history w/o making a
" useless, inefficient search?
! let s:prefix = matchstr(s:prefix, '\([^,]\+,\)\+\zs\([^,]\+\)\ze$')
silent! grep! ____HIGHLY_IMPROBABLE___ %
if g:Tex_RememberCiteSearch && exists('s:citeSearchHistory')
call <SID>Tex_SetupCWindow(s:citeSearchHistory)
else
! call Tex_Debug('calling Tex_GrepForBibItems', 'bib')
call Tex_GrepForBibItems(s:prefix)
redraw!
--- 87,96 ----
" TODO: Is there a way to clear the search-history w/o making a
" useless, inefficient search?
! let s:prefix = matchstr(s:prefix, '\([^,]\+,\)*\zs\([^,]\+\)\ze$')
silent! grep! ____HIGHLY_IMPROBABLE___ %
if g:Tex_RememberCiteSearch && exists('s:citeSearchHistory')
call <SID>Tex_SetupCWindow(s:citeSearchHistory)
else
! call Tex_Debug('calling Tex_GrepForBibItems', 'view')
call Tex_GrepForBibItems(s:prefix)
redraw!
***************
*** 169,173 ****
" Tex_CompleteWord: inserts a word at the chosen location {{{
! " Description:
function! Tex_CompleteWord(completeword)
exe s:pos
--- 169,175 ----
" Tex_CompleteWord: inserts a word at the chosen location {{{
! " Description: This function is meant to be called when the user press
! " ``<enter>`` in one of the [Error List] windows which shows the list of
! " matches. completeword is the rest of the word which needs to be inserted.
function! Tex_CompleteWord(completeword)
exe s:pos
***************
*** 346,349 ****
--- 348,352 ----
call Tex_CloseSmallWindows()
+ call Tex_Debug(":Tex_CompleteRefCiteCustom: completing with ".completeword, "view")
call Tex_CompleteWord(completeword)
endfunction " }}}
***************
*** 495,499 ****
" as soon as the first \bibliography or \begin{thebibliography} is found.
function! Tex_ScanFileForCite(prefix)
! call Tex_Debug('searching for bibkeys in '.bufname('%').' (buffer #'.bufnr('%').')', 'bib')
let presBufNum = bufnr('%')
--- 498,502 ----
" as soon as the first \bibliography or \begin{thebibliography} is found.
function! Tex_ScanFileForCite(prefix)
! call Tex_Debug('searching for bibkeys in '.bufname('%').' (buffer #'.bufnr('%').')', 'view')
let presBufNum = bufnr('%')
***************
*** 503,507 ****
" bibliography.
if search('\\bibliography{', 'w')
! call Tex_Debug('found bibliography command in '.bufname('%'), 'bib')
" convey that we have found a bibliography command. we do not need to
" proceed any further.
--- 506,510 ----
" bibliography.
if search('\\bibliography{', 'w')
! call Tex_Debug('found bibliography command in '.bufname('%'), 'view')
" convey that we have found a bibliography command. we do not need to
" proceed any further.
***************
*** 512,516 ****
let bibnames = substitute(bibnames, '\s', '', 'g')
! call Tex_Debug('trying to search through ['.bibnames.']', 'bib')
let i = 1
--- 515,519 ----
let bibnames = substitute(bibnames, '\s', '', 'g')
! call Tex_Debug('trying to search through ['.bibnames.']', 'view')
let i = 1
***************
*** 524,531 ****
split
let thisbufnum = bufnr('%')
! call Tex_Debug('silent! find '.Tex_Strntok(bibnames, ',', i).'.bib', 'bib')
exec 'silent! find '.Tex_Strntok(bibnames, ',', i).'.bib'
if bufnr('%') != thisbufnum
! call Tex_Debug('finding .bib file ['.bufname('%').']', 'bib')
lcd %:p:h
" use the appropriate syntax for the .bib file.
--- 527,535 ----
split
let thisbufnum = bufnr('%')
! call Tex_Debug('silent! find '.Tex_Strntok(bibnames, ',', i).'.bib', 'view')
exec 'silent! find '.Tex_Strntok(bibnames, ',', i).'.bib'
if bufnr('%') != thisbufnum
! call Tex_Debug('finding .bib file ['.bufname('%').']', 'view')
! call Tex_Debug('using pattern '.Tex_EscapeForGrep('@.*{'.a:prefix), 'view')
lcd %:p:h
" use the appropriate syntax for the .bib file.
***************
*** 534,540 ****
let thisbufnum = bufnr('%')
exec 'silent! find '.Tex_Strntok(bibnames, ',', i).'.bbl'
! call Tex_Debug('now in bufnum#'.bufnr('%'), 'bib')
if bufnr('%') != thisbufnum
! call Tex_Debug('finding .bbl file ['.bufname('.').']', 'bib')
lcd %:p:h
exec "silent! grepadd ".Tex_EscapeForGrep('\\bibitem{'.a:prefix)." %"
--- 538,544 ----
let thisbufnum = bufnr('%')
exec 'silent! find '.Tex_Strntok(bibnames, ',', i).'.bbl'
! call Tex_Debug('now in bufnum#'.bufnr('%'), 'view')
if bufnr('%') != thisbufnum
! call Tex_Debug('finding .bbl file ['.bufname('.').']', 'view')
lcd %:p:h
exec "silent! grepadd ".Tex_EscapeForGrep('\\bibitem{'.a:prefix)." %"
***************
*** 556,560 ****
" upwards by returning 1.
if search('^\s*\\begin{thebibliography}', 'w')
! call Tex_Debug('got a thebibliography environment in '.bufname('%'), 'bib')
let foundCiteFile = 1
--- 560,564 ----
" upwards by returning 1.
if search('^\s*\\begin{thebibliography}', 'w')
! call Tex_Debug('got a thebibliography environment in '.bufname('%'), 'view')
let foundCiteFile = 1
***************
*** 585,589 ****
if bufnr('%') != thisbufnum
" DANGER! recursive call.
! call Tex_Debug('scanning recursively in ['.bufname('%').']', 'bib')
let foundCiteFile = Tex_ScanFileForCite(a:prefix)
endif
--- 589,593 ----
if bufnr('%') != thisbufnum
" DANGER! recursive call.
! call Tex_Debug('scanning recursively in ['.bufname('%').']', 'view')
let foundCiteFile = Tex_ScanFileForCite(a:prefix)
endif
|