Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv17470
Modified Files:
packages.vim
Log Message:
check if in current directory exists user package and scan it for usepackage, newcommand etc. TODO - TEXINPUTS, use glob or globpath
Index: packages.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** packages.vim 28 Feb 2003 20:21:51 -0000 1.29
--- packages.vim 6 Apr 2003 22:59:50 -0000 1.30
***************
*** 186,189 ****
--- 186,191 ----
function! Tex_pack_all(fname)
+ let g:lastname = a:fname
+
let pos = line('.').' | normal! '.virtcol('.').'|'
let currfile = expand('%:p')
***************
*** 202,207 ****
" Scan
while search('^\s*\\usepackage\_.\{-}{\_.\+}', 'W')
! if line('.') > beginline
! break
endif
--- 204,212 ----
" Scan
while search('^\s*\\usepackage\_.\{-}{\_.\+}', 'W')
!
! if !exists("s:Tex_up_check")
! if line('.') > beginline
! break
! endif
endif
***************
*** 270,275 ****
while search('^\s*\\newcommand\*\?{.\{-}}', 'W')
! if line('.') > endline
! break
endif
--- 275,282 ----
while search('^\s*\\newcommand\*\?{.\{-}}', 'W')
! if !exists("s:Tex_up_check")
! if line('.') > endline
! break
! endif
endif
***************
*** 287,292 ****
while search('^\s*\\newenvironment\*\?{.\{-}}', 'W')
! if line('.') > endline
! break
endif
--- 294,301 ----
while search('^\s*\\newenvironment\*\?{.\{-}}', 'W')
! if !exists("s:Tex_up_check")
! if line('.') > endline
! break
! endif
endif
***************
*** 300,303 ****
--- 309,351 ----
q
endif
+
+ " Check if one of declared packages isn't user package in current (TODO:
+ " or $TEXINPUTS or declared in texrc or ...)
+ if !exists("s:Tex_up_check")
+ " Prevents endless loop
+ let s:Tex_up_check = 1
+
+ " Operate on list of packages from current/main file,
+ " g:Tex_package_detected will be changing
+ let tpd_orig = g:Tex_package_detected
+
+ " Iterate through original list
+ let fn = 1
+ while Tex_Strntok(tpd_orig, ',', fn) != ''
+ let userpackage = Tex_Strntok(tpd_orig, ',', fn)
+ let stypath = expand("%:p:h").'/'.userpackage.'.sty'
+
+ " If package with given name exists in user space (not TeX space)
+ " check if there are usepackage commands, newcommand etc.
+ if filereadable(stypath)
+ let g:path = stypath
+ call Tex_pack_all(stypath)
+
+ " Remove this file from list of buffers
+ exe 'bwipe '.stypath
+
+ " But add word completion - if such file exists probably there
+ " is huge collection of commands, <F7> doesn't solve
+ " everything
+ exe 'setlocal complete+=s'.stypath
+
+ endif
+
+ let fn = fn + 1
+
+ endwhile
+
+ endif
+
exe pos
endfunction
|