[Vim-latex-cvs] vimfiles/ftplugin/latex-suite packages.vim,1.7,1.8
Brought to you by:
srinathava,
tmaas
From: <mi...@us...> - 2002-11-10 18:09:45
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory usw-pr-cvs1:/tmp/cvs-serv18506 Modified Files: packages.vim Log Message: modification of function names TeX_... -> Tex_... cosmetic change, but this is easier to write them menu name: Update -> UpdatePackage more clear name (IMO) Fixed problem with UpdateAll. But here I see one problem. This works only if in file exists line \begin{document}. This is fundamental. IMO there is no sense in figuring out all ways of searching preamble. First 20 lines? If there are rich comments preamble can be much longer. Whole file? If this is file about latex in body of file can be line with \usepackage{ and menu will give information about file which noexists in preamble (and with weird formatting whole function may go to hell). Index: packages.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** packages.vim 21 May 2002 21:11:03 -0000 1.7 --- packages.vim 10 Nov 2002 18:09:39 -0000 1.8 *************** *** 4,8 **** " Version: 1.0 " Created: Tue Apr 23 06:00 PM 2002 PST ! " Last Change: czw maj 09 11:00 2002 U " " Description: handling packages from within vim --- 4,8 ---- " Version: 1.0 " Created: Tue Apr 23 06:00 PM 2002 PST ! " Last Change: nie lis 10 06:00 2002 C " " Description: handling packages from within vim *************** *** 32,36 **** function! Tex_pack_check(package) if has("gui_running") && filereadable(s:path."/packages/".a:package) ! call TeX_pack(a:package) let g:Tex_package_supported = g:Tex_package_supported.",".a:package endif --- 32,36 ---- function! Tex_pack_check(package) if has("gui_running") && filereadable(s:path."/packages/".a:package) ! call Tex_pack(a:package) let g:Tex_package_supported = g:Tex_package_supported.",".a:package endif *************** *** 70,76 **** let g:Tex_package_supported = "" let g:Tex_package_detected = "" ! call TeX_pack_all() else ! call TeX_pack_all() endif endfunction --- 70,76 ---- let g:Tex_package_supported = "" let g:Tex_package_detected = "" ! call Tex_pack_all() else ! call Tex_pack_all() endif endfunction *************** *** 95,103 **** endfunction " }}} ! " TeX_pack_all: scans the current file for \\usepackage{ lines {{{ " and loads the corresponding package options as menus. ! function! TeX_pack_all() let pos = line('.').' | normal! '.virtcol('.').'|' if Tex_GetMainFileName() != '' --- 95,104 ---- endfunction " }}} ! " Tex_pack_all: scans the current file for \\usepackage{ lines {{{ " and loads the corresponding package options as menus. ! function! Tex_pack_all() let pos = line('.').' | normal! '.virtcol('.').'|' + let currfile = expand('%:p') if Tex_GetMainFileName() != '' *************** *** 109,120 **** let fname = '' else ! let fname = expand('%:p') endif else ! let fname = expand('%:p') endif let toquit = 0 ! if fname != expand('%:p') exe 'split '.fname let toquit = 1 --- 110,121 ---- let fname = '' else ! let fname = currfile endif else ! let fname = currfile endif let toquit = 0 ! if fname != currfile exe 'split '.fname let toquit = 1 *************** *** 162,168 **** " }}} ! " TeX_pack_supp_menu: sets up a menu for packages found in packages/ {{{ " groups the packages thus found into groups of 20... ! function! TeX_pack_supp_menu() let g:suplist = glob(s:path."/packages/*") let g:suplist = substitute(g:suplist, "\n", ",", "g") --- 163,169 ---- " }}} ! " Tex_pack_supp_menu: sets up a menu for packages found in packages/ {{{ " groups the packages thus found into groups of 20... ! function! Tex_pack_supp_menu() let g:suplist = glob(s:path."/packages/*") let g:suplist = substitute(g:suplist, "\n", ",", "g") *************** *** 186,190 **** endif endif ! exe "amenu ".s:p_menu_lev."&Supported".OptMenu.".&".fptr." :call TeX_pack_supp('".fpt."')<CR>" let basic_nu_s_list = basic_nu_s_list + 1 endwhile --- 187,191 ---- endif endif ! exe "amenu ".s:p_menu_lev."&Supported".OptMenu.".&".fptr." :call Tex_pack_supp('".fpt."')<CR>" let basic_nu_s_list = basic_nu_s_list + 1 endwhile *************** *** 192,197 **** " }}} ! " TeX_pack: loads the options (and commands) for the given package {{{ ! function! TeX_pack(pack) let basic_nu_p_list = "" let nu_p_list = "" --- 193,198 ---- " }}} ! " Tex_pack: loads the options (and commands) for the given package {{{ ! function! Tex_pack(pack) let basic_nu_p_list = "" let nu_p_list = "" *************** *** 334,338 **** endif exe "amenu ".s:p_menu_lev."&".a:pack.ComMenu.".".l_m_item." ".r_m_item ! let basic_nu_p_list = basic_nu_p_list + 1 let loop_nu = loop_nu + 1 endwhile " }}} --- 335,339 ---- endif exe "amenu ".s:p_menu_lev."&".a:pack.ComMenu.".".l_m_item." ".r_m_item ! let basic_nu_p_list = basic_nu_p_list + 1 let loop_nu = loop_nu + 1 endwhile " }}} *************** *** 342,348 **** " }}} ! " TeX_pack_supp: "supports" the package... {{{ ! function! TeX_pack_supp(supp_pack) ! call TeX_pack(a:supp_pack) exe "let g:s_p_o = g:TeX_package_option_".a:supp_pack if exists("g:s_p_o") && g:s_p_o != "" --- 343,349 ---- " }}} ! " Tex_pack_supp: "supports" the package... {{{ ! function! Tex_pack_supp(supp_pack) ! call Tex_pack(a:supp_pack) exe "let g:s_p_o = g:TeX_package_option_".a:supp_pack if exists("g:s_p_o") && g:s_p_o != "" *************** *** 352,355 **** --- 353,361 ---- exe "normal i\\usepackage{".a:supp_pack."}\<cr>" endif + if g:Tex_package_supported == "" + let g:Tex_package_supported = a:supp_pack + else + let g:Tex_package_supported = g:Tex_package_supported . ",". a:supp_pack + endif endfunction *************** *** 357,368 **** if g:Tex_Menus ! exe "amenu ".s:p_menu_lev."&Update :call TeX_pack(expand('<cword>'))<cr>" exe "amenu ".s:p_menu_lev."&UpdateAll :call Tex_pack_updateall()<cr>" endif if g:Tex_Menus ! call TeX_pack_supp_menu() ! call TeX_pack_all() endif ! " vim:fdm=marker:ts=4:sw=4:noet --- 363,374 ---- if g:Tex_Menus ! exe "amenu ".s:p_menu_lev."&UpdatePackage :call Tex_pack(expand('<cword>'))<cr>" exe "amenu ".s:p_menu_lev."&UpdateAll :call Tex_pack_updateall()<cr>" endif if g:Tex_Menus ! call Tex_pack_supp_menu() ! call Tex_pack_all() endif ! " vim:fdm=marker:ts=4:sw=4:noet:fo-=wa1 |