Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv22094
Modified Files:
main.vim packages.vim templates.vim custommacros.vim ChangeLog
Log Message:
s/FileInRtp/FindInRtp/ and small optimizations in templates.vim and custommacros.vim
Index: main.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** main.vim 28 Sep 2003 22:53:38 -0000 1.49
--- main.vim 29 Sep 2003 02:23:49 -0000 1.50
***************
*** 584,593 ****
endfunction " }}}
" }}}
! " Tex_FileInRtp: check if file exists in &rtp {{{
" Description: Checks if file exists in globpath(&rtp, ...) and cuts off the
" rest of returned names. This guarantees that sourced file is
" from $HOME. Drawback: doesn't respect special after directory.
" If first argument == '' return list of files separated with \n
! function! Tex_FileInRtp(filename, directory)
" We need different behavior for each special subdirectory:
if a:directory == 'packages'
--- 584,593 ----
endfunction " }}}
" }}}
! " Tex_FindInRtp: check if file exists in &rtp {{{
" Description: Checks if file exists in globpath(&rtp, ...) and cuts off the
" rest of returned names. This guarantees that sourced file is
" from $HOME. Drawback: doesn't respect special after directory.
" If first argument == '' return list of files separated with \n
! function! Tex_FindInRtp(filename, directory)
" We need different behavior for each special subdirectory:
if a:directory == 'packages'
Index: packages.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** packages.vim 28 Sep 2003 22:53:38 -0000 1.40
--- packages.vim 29 Sep 2003 02:23:49 -0000 1.41
***************
*** 33,37 ****
function! Tex_CompletePackageName(A,P,L)
" Get name of packages from all runtimepath directories
! let packnames = Tex_FileInRtp('', 'packages')
let packnames = substitute(packnames, '^,', '', 'e')
" Separate names with \n not ,
--- 33,37 ----
function! Tex_CompletePackageName(A,P,L)
" Get name of packages from all runtimepath directories
! let packnames = Tex_FindInRtp('', 'packages')
let packnames = substitute(packnames, '^,', '', 'e')
" Separate names with \n not ,
***************
*** 61,68 ****
"
function! Tex_pack_check(package)
! " Use Tex_FileInRtp() function to get first name from packages list in all
" rtp directories conforming with latex-suite directories hierarchy
" Store names in variables to process functions only once.
! let packname = Tex_FileInRtp(a:package, 'packages')
if packname != ''
exe 'runtime! ftplugin/latex-suite/packages/' . a:package
--- 61,68 ----
"
function! Tex_pack_check(package)
! " Use Tex_FindInRtp() function to get first name from packages list in all
" rtp directories conforming with latex-suite directories hierarchy
" Store names in variables to process functions only once.
! let packname = Tex_FindInRtp(a:package, 'packages')
if packname != ''
exe 'runtime! ftplugin/latex-suite/packages/' . a:package
***************
*** 75,79 ****
endif
" Return full list of dictionaries (separated with ,) for package in &rtp
! let dictname = Tex_FileInRtp(a:package, 'dictionaries')
if dictname != ''
exe 'setlocal dict+=' . dictname
--- 75,79 ----
endif
" Return full list of dictionaries (separated with ,) for package in &rtp
! let dictname = Tex_FindInRtp(a:package, 'dictionaries')
if dictname != ''
exe 'setlocal dict+=' . dictname
***************
*** 92,102 ****
" Tex_pack_uncheck: removes package from menu and 'dict' settings. {{{
function! Tex_pack_uncheck(package)
! if has("gui_running") && Tex_FileInRtp(a:package, 'packages') != ''
exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.'-sep'.a:package.'-'
exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Options'
exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Commands'
endif
! if Tex_FileInRtp(a:package, 'dictionaries') != ''
! exe 'setlocal dict-='.Tex_FileInRtp(a:package, 'dictionaries')
endif
endfunction
--- 92,102 ----
" Tex_pack_uncheck: removes package from menu and 'dict' settings. {{{
function! Tex_pack_uncheck(package)
! if has("gui_running") && Tex_FindInRtp(a:package, 'packages') != ''
exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.'-sep'.a:package.'-'
exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Options'
exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Commands'
endif
! if Tex_FindInRtp(a:package, 'dictionaries') != ''
! exe 'setlocal dict-='.Tex_FindInRtp(a:package, 'dictionaries')
endif
endfunction
***************
*** 258,266 ****
function! Tex_pack_one(...)
if a:0 == 0 || (a:0 > 0 && a:1 == '')
let packname = Tex_ChooseFromPrompt(
\ "Choose a package: \n" .
! \ Tex_CreatePrompt(Tex_FileInRtp('','packages'), "3", ",") .
\ "\nEnter number or filename :",
! \ Tex_FileInRtp('','packages'), "\n")
if packname != ''
return Tex_pack_one(packname)
--- 258,267 ----
function! Tex_pack_one(...)
if a:0 == 0 || (a:0 > 0 && a:1 == '')
+ let packlist = Tex_FindInRtp('', 'packages')
let packname = Tex_ChooseFromPrompt(
\ "Choose a package: \n" .
! \ Tex_CreatePrompt(packlist, '3', ',') .
\ "\nEnter number or filename :",
! \ packlist, ',')
if packname != ''
return Tex_pack_one(packname)
***************
*** 275,279 ****
while omega <= a:0
let packname = a:{omega}
! if Tex_FileInRtp(packname, 'packages') != ''
call Tex_pack_check(packname)
if exists('g:TeX_package_option_'.packname)
--- 276,280 ----
while omega <= a:0
let packname = a:{omega}
! if Tex_FindInRtp(packname, 'packages') != ''
call Tex_pack_check(packname)
if exists('g:TeX_package_option_'.packname)
Index: templates.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/templates.vim,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** templates.vim 28 Sep 2003 22:53:38 -0000 1.12
--- templates.vim 29 Sep 2003 02:23:49 -0000 1.13
***************
*** 16,20 ****
" SetTemplateMenu: sets up the menu for templates {{{
function! <SID>SetTemplateMenu()
! let flist = Tex_FileInRtp('', 'templates')
let i = 1
while 1
--- 16,20 ----
" SetTemplateMenu: sets up the menu for templates {{{
function! <SID>SetTemplateMenu()
! let flist = Tex_FindInRtp('', 'templates')
let i = 1
while 1
***************
*** 41,52 ****
let filename = a:1.'.*'
else
let filename =
\ Tex_ChooseFromPrompt("Choose a template file:\n" .
! \ Tex_CreatePrompt(Tex_FileInRtp('', 'templates'), 2, ",") .
\ "\nEnter number or name of file :",
! \ Tex_FileInRtp('', 'templates'), ",")
endif
! let fname = Tex_FileInRtp(filename, 'templates')
silent! exe "0read ".fname
" The first line of the file contains the specifications of what the
--- 41,53 ----
let filename = a:1.'.*'
else
+ let filelist = Tex_FindInRtp('', 'templates')
let filename =
\ Tex_ChooseFromPrompt("Choose a template file:\n" .
! \ Tex_CreatePrompt(filelist, 2, ',') .
\ "\nEnter number or name of file :",
! \ filelist, ',')
endif
! let fname = Tex_FindInRtp(filename, 'templates')
silent! exe "0read ".fname
" The first line of the file contains the specifications of what the
***************
*** 104,108 ****
" }}}
!
if v:version >= 602
com! -complete=custom,Tex_CompleteTemplateName -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>)
--- 105,109 ----
" }}}
! " Command definitions {{{
if v:version >= 602
com! -complete=custom,Tex_CompleteTemplateName -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>)
***************
*** 113,122 ****
" Tex_CompleteTemplateName: for completing names in TTemplate command {{{
! " Description: get list of template names with Tex_FileInRtp(), remove full path
" and return list of names separated with newlines.
"
function! Tex_CompleteTemplateName(A,P,L)
" Get name of macros from all runtimepath directories
! let tmplnames = Tex_FileInRtp('', 'templates')
" Separate names with \n not ,
let tmplnames = substitute(tmplnames,',','\n','g')
--- 114,123 ----
" Tex_CompleteTemplateName: for completing names in TTemplate command {{{
! " Description: get list of template names with Tex_FindInRtp(), remove full path
" and return list of names separated with newlines.
"
function! Tex_CompleteTemplateName(A,P,L)
" Get name of macros from all runtimepath directories
! let tmplnames = Tex_FindInRtp('', 'templates')
" Separate names with \n not ,
let tmplnames = substitute(tmplnames,',','\n','g')
***************
*** 133,136 ****
--- 134,139 ----
endif
+
+ " }}}
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4
Index: custommacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/custommacros.vim,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** custommacros.vim 29 Sep 2003 00:43:44 -0000 1.16
--- custommacros.vim 29 Sep 2003 02:23:49 -0000 1.17
***************
*** 26,30 ****
" SetCustomMacrosMenu: sets up the menu for Macros {{{
function! <SID>SetCustomMacrosMenu()
! let flist = Tex_FileInRtp('', 'macros')
exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call <SID>NewMacro("FFFromMMMenu")<CR>'
exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call RedrawMacro()<CR>'
--- 26,30 ----
" SetCustomMacrosMenu: sets up the menu for Macros {{{
function! <SID>SetCustomMacrosMenu()
! let flist = Tex_FindInRtp('', 'macros')
exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call <SID>NewMacro("FFFromMMMenu")<CR>'
exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call RedrawMacro()<CR>'
***************
*** 69,73 ****
return
endif
! elseif Tex_FileInRtp(newmacroname, 'macros') != ''
" If macro with this name already exists, prompt for another name.
exe "echomsg 'Macro ".newmacroname." already exists. Try another name.'"
--- 69,73 ----
return
endif
! elseif Tex_FindInRtp(newmacroname, 'macros') != ''
" If macro with this name already exists, prompt for another name.
exe "echomsg 'Macro ".newmacroname." already exists. Try another name.'"
***************
*** 92,96 ****
" " Description:
function! s:ChooseMacro(ask)
! let filelist = Tex_FileInRtp('', 'macros')
let filename = Tex_ChooseFromPrompt(
\ a:ask."\n" .
--- 92,96 ----
" " Description:
function! s:ChooseMacro(ask)
! let filelist = Tex_FindInRtp('', 'macros')
let filename = Tex_ChooseFromPrompt(
\ a:ask."\n" .
***************
*** 142,146 ****
if ch == 1
new
! exe '0read '.Tex_FileInRtp(filename, 'macros')
exe 'write '.s:macrodirpath.filename.'-local'
endif
--- 142,146 ----
if ch == 1
new
! exe '0read '.Tex_FindInRtp(filename, 'macros')
exe 'write '.s:macrodirpath.filename.'-local'
endif
***************
*** 158,162 ****
let filename = a:1
else
! let filelist = Tex_FileInRtp('', 'macros')
let filename =
\ Tex_ChooseFromPrompt("Choose a macro file:\n" .
--- 158,162 ----
let filename = a:1
else
! let filelist = Tex_FindInRtp('', 'macros')
let filename =
\ Tex_ChooseFromPrompt("Choose a macro file:\n" .
***************
*** 166,170 ****
endif
! let fname = Tex_FileInRtp(filename, 'macros')
let markerString = '<---- Latex Suite End Macro ---->'
--- 166,170 ----
endif
! let fname = Tex_FindInRtp(filename, 'macros')
let markerString = '<---- Latex Suite End Macro ---->'
***************
*** 205,214 ****
" Tex_CompleteMacroName: for completing names in TMacro... commands {{{
! " Description: get list of macro names with Tex_FileInRtp(), remove full path
" and return list of names separated with newlines.
"
function! Tex_CompleteMacroName(A,P,L)
" Get name of macros from all runtimepath directories
! let macronames = Tex_FileInRtp('', 'macros')
" Separate names with \n not ,
let macronames = substitute(macronames,',','\n','g')
--- 205,214 ----
" Tex_CompleteMacroName: for completing names in TMacro... commands {{{
! " Description: get list of macro names with Tex_FindInRtp(), remove full path
" and return list of names separated with newlines.
"
function! Tex_CompleteMacroName(A,P,L)
" Get name of macros from all runtimepath directories
! let macronames = Tex_FindInRtp('', 'macros')
" Separate names with \n not ,
let macronames = substitute(macronames,',','\n','g')
Index: ChangeLog
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/ChangeLog,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ChangeLog 28 Sep 2003 22:54:07 -0000 1.11
--- ChangeLog 29 Sep 2003 02:23:49 -0000 1.12
***************
*** 13,17 ****
Make jumping to warning/error configurable. (Preben Randhol, MM)
* packages.vim, templates.vim, custommacros.vim, main.vim:
! New function, Tex_FileInRtp makes possible to use files from
system-wide directories and local. Appropriate changes in pluginable
features - packages, directories, templates, macros. (MM)
--- 13,17 ----
Make jumping to warning/error configurable. (Preben Randhol, MM)
* packages.vim, templates.vim, custommacros.vim, main.vim:
! New function, Tex_FindInRtp makes possible to use files from
system-wide directories and local. Appropriate changes in pluginable
features - packages, directories, templates, macros. (MM)
|