Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv28011
Modified Files:
packages.vim
Log Message:
- Use Tex_ChooseFromPrompt instead of Tex_ChooseFile
- Also create global variables of the form
g:Tex_{packname}_options
which contains options corresponding to \usepackage{packname}.
Index: packages.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** packages.vim 16 Jan 2003 17:49:08 -0000 1.24
--- packages.vim 17 Jan 2003 05:26:34 -0000 1.25
***************
*** 96,100 ****
let pwd = getcwd()
exe 'cd '.s:path.'/packages'
! let packname = Tex_ChooseFile('Choose a package: ')
exe 'cd '.pwd
if packname != ''
--- 96,104 ----
let pwd = getcwd()
exe 'cd '.s:path.'/packages'
! let packname = Tex_ChooseFromPrompt(
! \ "Choose a package: \n" .
! \ Tex_CreatePrompt(glob('*'), 3, "\n") .
! \ "\nEnter number or filename :",
! \ glob('*'), "\n")
exe 'cd '.pwd
if packname != ''
***************
*** 129,136 ****
" Tex_pack_all: scans the current file for \usepackage{} lines {{{
" and if supported, loads the options and commands found in the
! " corresponding package file.
! " Now scans also for \newenvironment and \newcommand lines and adds names to
! " g:Tex_Prompted variables, they can be easy available through <F5> and <F7>
! " shortcuts
function! Tex_pack_all()
--- 133,139 ----
" Tex_pack_all: scans the current file for \usepackage{} lines {{{
" and if supported, loads the options and commands found in the
! " corresponding package file. Also scans for \newenvironment and
! " \newcommand lines and adds names to g:Tex_Prompted variables, they can be
! " easy available through <F5> and <F7> shortcuts
function! Tex_pack_all()
***************
*** 163,166 ****
--- 166,181 ----
let saveA = @a
+ " If there are options, then find those.
+ if getline('.') =~ '\\usepackage\[.\{-}\]'
+ let options = matchstr(getline('.'), '\\usepackage\[\zs.\{-}\ze\]')
+ elseif getline('.') =~ '\\usepackage\['
+ " Entering here means that the user has split the \usepackage
+ " across newlines. Therefore, use yank.
+ exec "normal! /\[\<CR>lv/\]\<CR>h\"ay"
+ let options = @a
+ else
+ let options = ''
+ endif
+
" The following statement puts the stuff between the { }'s of a
" \usepackage{stuff,foo} into @a. Do not use matchstr() and the like
***************
*** 183,186 ****
--- 198,210 ----
" Should we bother taking care of this?
let g:Tex_package_detected = g:Tex_package_detected.','.@a
+
+ " For each package found, form a global variable of the form
+ " g:Tex_{packagename}_options
+ " which contains a list of the options.
+ let j = 1
+ while Tex_Strntok(@a, ',', j) != ''
+ let g:Tex_{Tex_Strntok(@a, ',', j)}_options = options
+ let j = j + 1
+ endwhile
" Finally convert @a into something like '"pack1","pack2"'
|