[Vim-latex-cvs] vimfiles/ftplugin/latex-suite packages.vim,1.30,1.31
Brought to you by:
srinathava,
tmaas
|
From: <mi...@us...> - 2003-04-07 20:53:11
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv7179
Modified Files:
packages.vim
Log Message:
Dealing with TEXINPUTS and packages.
Unfortunately relations of Vim with shell are not
straightforwart. We cannot assume that always we
will know its value. Much simplier (although not
so elegant) is g:Tex_TEXINPUTS variable.
This should be equal to real $TEXINPUTS. More info
in latex-suite.txt - |latex-package-scanning|
Index: packages.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** packages.vim 6 Apr 2003 22:59:50 -0000 1.30
--- packages.vim 7 Apr 2003 20:53:03 -0000 1.31
***************
*** 310,315 ****
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
--- 310,315 ----
endif
! " Check if one of declared packages isn't user package in current
! " Basing on TEXINPUTS.
if !exists("s:Tex_up_check")
" Prevents endless loop
***************
*** 326,344 ****
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
--- 326,422 ----
let stypath = expand("%:p:h").'/'.userpackage.'.sty'
! " If package with given name exists in current dir
" check if there are usepackage commands, newcommand etc.
if filereadable(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
+
+ " Check list of locations from $TEXINPUTS variable. But before simple
+ " trick - add current directory to make everything in one loop
+ if g:Tex_TEXINPUTS != ''
+ let inputdirs = g:Tex_TEXINPUTS
+
+ let id = 1
+ while Tex_Strntok(inputdirs, ':', id) != ''
+ let cur_input_dir = Tex_Strntok(inputdirs, ':', id)
+
+ " Skip current directory, we checked it already
+ if cur_input_dir == "\\." || cur_input_dir == "\\./"
+ let g:cid1 = cur_input_dir
+ let id = id + 1
+ continue
+
+ " Deal with ./ entries
+ elseif cur_input_dir =~ "^\\./"
+ let g:cid2 = cur_input_dir
+
+ let cur_dir = expand("%:p:h")
+
+ if cur_input_dir == './/'
+ let stypath = globpath(cur_dir.'/*', userpackage.'.sty')
+ if filereadable(stypath)
+ call Tex_pack_all(stypath)
+ exe 'bwipe '.stypath
+ exe 'setlocal complete+=s'.stypath
+ endif
+
+ else
+ let cur_input_dir = substitute(cur_input_dir,'./','','e')
+ let stypath = cur_dir.'/'.cur_input_dir.'/'.userpackage.'.sty'
+ if filereadable(stypath)
+ call Tex_pack_all(stypath)
+ exe 'bwipe '.stypath
+ exe 'setlocal complete+=s'.stypath
+ endif
+
+ endif
+
+ " Check one-level directory item variable.
+ elseif cur_input_dir !~ '//$'
+ let cur_input_dir = substitute(cur_input_dir,'/*$','','ge')
+ let stypath = cur_input_dir.'/'.userpackage.'.sty'
+ let stypath = fnamemodify(stypath, ':p')
+ if filereadable(stypath)
+ call Tex_pack_all(stypath)
+ exe 'bwipe '.stypath
+ exe 'setlocal complete+=s'.stypath
+ endif
+
+ " Check the rest. Now this is fake because currently Vim
+ " doesn't accept ** in globpath(). Solution with '/*'
+ " provides only one level depth but ** in globpath() is on
+ " TODO list. In future versions of Vim we will only need
+ " to add one * in globpath.
+ else
+ let cur_input_dir = substitute(cur_input_dir,'/*$','','ge')
+ let stypath = fnamemodify(cur_input_dir, ':p:h')
+
+ let stypath2 = stypath.'/'.userpackage.'.sty'
+ if filereadable(stypath2)
+ call Tex_pack_all(stypath2)
+ exe 'bwipe '.stypath2
+ exe 'setlocal complete+=s'.stypath2
+ endif
+
+ let stypathglob = globpath(stypath.'/*', userpackage.'.sty')
+ if filereadable(stypathglob)
+ call Tex_pack_all(stypathglob)
+ exe 'bwipe '.stypathglob
+ exe 'setlocal complete+=s'.stypathglob
+ endif
+
+ endif
+
+ let id = id + 1
+
+ endif
+
+ endwhile
let fn = fn + 1
|