Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv20054
Modified Files:
main.vim packages.vim templates.vim custommacros.vim
Log Message:
This is big commit.
In main.vim new function Tex_FileInRtp. Now we can find files for
packages, templates and macros in all runtime directories.
Results are different for all types. For package files it source all of
them in order according to &rtp. In this way package files are treated
as normal Vim plugin files and behaviour for each package can be
modified as for ftplugin files in .vim, /usr/.../vim, and .vim/after
directories.
For templates it allows to see files in system-wide and local
directories. File in the local directory with the same name as in system
dir will overshadow system template.
For macros basic behaviour is the same but if someone will try to
TMacroEdit system-wide macro file will be copied to local version of
macros dir with suffix to name '-local'. Awkward but avoids situation
when user removes local copy of system macro and still see this macro in
menu (and in completion of : command).
If user choose to remove file latexSuite refuse to remove system file.
Completion of : commands relating for packages, templates, macros. Looks
in all &rtp directories.
Index: main.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/main.vim,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** main.vim 28 Sep 2003 22:52:45 -0000 1.48
--- main.vim 28 Sep 2003 22:53:38 -0000 1.49
***************
*** 584,587 ****
--- 584,637 ----
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'
+ if a:filename != ''
+ let filepath = globpath(&rtp, "ftplugin/latex-suite/packages/".a:filename)
+ "if filepath != '' && filepath =~ '\n'
+ "let filepath = substitute(filepath, '\n.*', '', '')
+ "endif
+ return filepath
+ else
+ " Return list of packages separated with ,
+ let list = globpath(&rtp, "ftplugin/latex-suite/packages/*")
+ let list = substitute(list,'\n',',','g')
+ let list = substitute(list,'^\|,[^,]*/',',','g')
+ return list
+ endif
+ elseif a:directory == 'dictionaries'
+ if a:filename != ''
+ " Return list of dictionaries separated with ,
+ let filepath = globpath(&rtp, "ftplugin/latex-suite/dictionaries/".a:filename)
+ let filepath = substitute(filepath, '\n', ',', 'g')
+ return filepath
+ endif
+ elseif a:directory =~ 'macros\|templates'
+ if a:filename != ''
+ " Return first file extracted from &rtp
+ let filepath = globpath(&rtp, "ftplugin/latex-suite/".a:directory."/".a:filename)
+ if filepath != '' && filepath =~ '\n'
+ let filepath = substitute(filepath, '\n.*', '', '')
+ endif
+ return filepath
+ else
+ " Return list of macros/templates separated with ,
+ let list = globpath(&rtp, "ftplugin/latex-suite/".a:directory."/*")
+ let list = substitute(list,'\n',',','g')
+ let list = substitute(list,'^\|,[^,]*/',',','g')
+ let list = substitute(list,'^,', '', '')
+ let list = substitute(list,'\.tex', '', 'ge')
+ return list
+ endif
+ endif
+
+ endfunction
+
+ " }}}
" source texproject.vim before other files
***************
*** 654,657 ****
--- 704,708 ----
" Settings for taglist.vim plugin
" ==============================================================================
+ " Sets Tlist_Ctags_Cmd for taglist.vim and regexps for ctags {{{
if exists("g:Tex_TaglistSupport") && g:Tex_TaglistSupport == 1
if !exists("g:tlist_tex_settings")
***************
*** 686,689 ****
--- 737,742 ----
endif
+ " }}}
+
" commands to completion
let g:Tex_completion_explorer = ','
Index: packages.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/packages.vim,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** packages.vim 4 Aug 2003 20:18:53 -0000 1.39
--- packages.vim 28 Sep 2003 22:53:38 -0000 1.40
***************
*** 32,38 ****
"
function! Tex_CompletePackageName(A,P,L)
! let packnames = globpath(s:path.'/packages','*')
! let packnames = substitute(packnames,'\n',',','g')
! let packnames = substitute(packnames,'^\|,[^,]*/',',','g')
let packnames = substitute(packnames,',','\n','g')
return packnames
--- 32,39 ----
"
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 ,
let packnames = substitute(packnames,',','\n','g')
return packnames
***************
*** 60,65 ****
"
function! Tex_pack_check(package)
! if filereadable(s:path.'/packages/'.a:package)
! exe 'source ' . s:path . '/packages/' . a:package
if has("gui_running")
call Tex_pack(a:package)
--- 61,70 ----
"
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
if has("gui_running")
call Tex_pack(a:package)
***************
*** 69,75 ****
endif
endif
! if filereadable(s:path.'/dictionaries/'.a:package)
! exe 'setlocal dict+='.s:path.'/dictionaries/'.a:package
! if filereadable(s:path.'/dictionaries/'.a:package) && g:Tex_package_supported !~ a:package
let g:Tex_package_supported = g:Tex_package_supported.','.a:package
endif
--- 74,82 ----
endif
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
! if g:Tex_package_supported !~ a:package
let g:Tex_package_supported = g:Tex_package_supported.','.a:package
endif
***************
*** 85,99 ****
" Tex_pack_uncheck: removes package from menu and 'dict' settings. {{{
function! Tex_pack_uncheck(package)
! if has("gui_running") && filereadable(s:path.'/packages/'.a:package)
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 filereadable(s:path.'/dictionaries/'.a:package)
! exe 'setlocal dict-='.s:path.'/dictionaries/'.a:package
endif
endfunction
" }}}
" Tex_pack_updateall: updates the TeX-Packages menu {{{
" Description:
--- 92,108 ----
" 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
" }}}
+ " This function should go to main.vim for reuse with templates and macros.
+ " I keep it here because want to do it in onefile patch.
" Tex_pack_updateall: updates the TeX-Packages menu {{{
" Description:
***************
*** 249,260 ****
function! Tex_pack_one(...)
if a:0 == 0 || (a:0 > 0 && a:1 == '')
- 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 != ''
return Tex_pack_one(packname)
--- 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)
***************
*** 269,273 ****
while omega <= a:0
let packname = a:{omega}
! if filereadable(s:path.'/packages/'.packname)
call Tex_pack_check(packname)
if exists('g:TeX_package_option_'.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)
***************
*** 453,462 ****
function! Tex_pack_supp_menu()
! let pwd = getcwd()
! exec 'cd '.s:path.'/packages'
! let suplist = glob("*")
! exec 'cd '.pwd
!
! let suplist = substitute(suplist, "\n", ',', 'g').','
call Tex_MakeSubmenu(suplist, g:Tex_PackagesMenuLocation.'Supported.',
--- 459,467 ----
function! Tex_pack_supp_menu()
! " Get list of packages in all rtp directories.
! " TODO: sort it and get rid of duplicate entries.
! let suplist = globpath(&rtp, "ftplugin/latex-suite/packages/*")
! let suplist = substitute(suplist,'\n',',','g')
! let suplist = substitute(suplist,'^\|,[^,]*/',',','g').","
call Tex_MakeSubmenu(suplist, g:Tex_PackagesMenuLocation.'Supported.',
Index: templates.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/templates.vim,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** templates.vim 21 Jan 2003 22:15:40 -0000 1.11
--- templates.vim 28 Sep 2003 22:53:38 -0000 1.12
***************
*** 3,8 ****
--- 3,10 ----
" Author: Gergely Kontra
" (minor modifications by Srinath Avadhanula)
+ " (plus other modifications by Mikolaj Machowski)
" Version: 1.0
" Created: Tue Apr 23 05:00 PM 2002 PST
+ " CVS: $Id$
"
" Description: functions for handling templates in latex-suite/templates
***************
*** 14,31 ****
" SetTemplateMenu: sets up the menu for templates {{{
function! <SID>SetTemplateMenu()
! let flist = glob(s:path."/templates/*")
let i = 1
while 1
! let fname = Tex_Strntok(flist, "\n", i)
if fname == ''
break
endif
! let fnameshort = fnamemodify(fname, ':p:t:r')
! if fnameshort == ''
! let i = i + 1
! continue
! endif
! exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fnameshort." ".
! \":call <SID>ReadTemplate('".fnameshort."')<CR>".
\":call <SID>ProcessTemplate()<CR>:0<CR>".
\"i<C-r>=IMAP_Jumpfunc('', 1)<CR>"
--- 16,28 ----
" SetTemplateMenu: sets up the menu for templates {{{
function! <SID>SetTemplateMenu()
! let flist = Tex_FileInRtp('', 'templates')
let i = 1
while 1
! let fname = Tex_Strntok(flist, ',', i)
if fname == ''
break
endif
! exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fname." ".
! \":call <SID>ReadTemplate('".fname."')<CR>".
\":call <SID>ProcessTemplate()<CR>:0<CR>".
\"i<C-r>=IMAP_Jumpfunc('', 1)<CR>"
***************
*** 44,58 ****
let filename = a:1.'.*'
else
- let pwd = getcwd()
- exe 'cd '.s:path.'/templates'
let filename =
\ Tex_ChooseFromPrompt("Choose a template file:\n" .
! \ Tex_CreatePrompt(glob('*'), 2, "\n") .
\ "\nEnter number or name of file :",
! \ glob('*'), "\n")
! exe 'cd '.pwd
endif
! let fname = glob(s:path."/templates/".filename)
silent! exe "0read ".fname
" The first line of the file contains the specifications of what the
--- 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
***************
*** 111,119 ****
" }}}
! com! -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>)
! \| :call <SID>ProcessTemplate()
! \| :0
! \| :exec "normal! i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>"
! \| :startinsert
" vim:fdm=marker:ff=unix:noet:ts=4:sw=4
--- 105,136 ----
" }}}
! if v:version >= 602
! com! -complete=custom,Tex_CompleteTemplateName -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>)
! \| :call <SID>ProcessTemplate()
! \| :0
! \| :exec "normal! i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>"
! \| :startinsert
!
! " 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')
! return tmplnames
! endfunction
! " }}}
!
! else
! com! -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>)
! \| :call <SID>ProcessTemplate()
! \| :0
! \| :exec "normal! i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>"
! \| :startinsert
!
! 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.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** custommacros.vim 19 Jul 2003 07:05:47 -0000 1.14
--- custommacros.vim 28 Sep 2003 22:53:38 -0000 1.15
***************
*** 4,7 ****
--- 4,8 ----
" Version: 1.0
" Created: Tue Apr 23 05:00 PM 2002 PST
+ " CVS: $Id$
"
" Description: functions for processing custom macros in the
***************
*** 11,31 ****
let s:path = expand('<sfile>:p:h')
" SetCustomMacrosMenu: sets up the menu for Macros {{{
function! <SID>SetCustomMacrosMenu()
! let flist = glob(s:path."/macros/*")
! exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call <SID>NewMacro()<CR>'
! exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call <SID>RedrawMacro()<CR>'
let i = 1
while 1
! let fname = Tex_Strntok(flist, "\n", i)
if fname == ''
break
endif
! let fnameshort = fnamemodify(fname, ':p:t:r')
! exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":<tab>".fnameshort." :call <SID>DeleteMacro('".fnameshort."')<CR>"
! exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":<tab>".fnameshort." :call <SID>EditMacro('".fnameshort."')<CR>"
! exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fnameshort." <C-r>=<SID>ReadMacro('".fnameshort."')<CR>"
! exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fnameshort." i<C-r>=<SID>ReadMacro('".fnameshort."')<CR>"
let i = i + 1
endwhile
--- 12,43 ----
let s:path = expand('<sfile>:p:h')
+ " Set path to macros dir dependent on OS {{{
+ if has("unix") || has("macunix")
+ let s:macrodirpath = $HOME."/.vim/ftplugin/latex-suite/macros/"
+ elseif has("win32")
+ if exists("$HOME")
+ let s:macrodirpath = $HOME."/vimfiles/ftplugin/latex-suite/macros/"
+ else
+ let s:macrodirpath = $VIMRUNTIME."/ftplugin/latex-suite/macros/"
+ endif
+ endif
+
+ " }}}
" SetCustomMacrosMenu: sets up the menu for Macros {{{
function! <SID>SetCustomMacrosMenu()
! let flist = Tex_FileInRtp('', 'macros')
! exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call NewMacro()<CR>'
! exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call RedrawMacro()<CR>'
let i = 1
while 1
! let fname = Tex_Strntok(flist, ',', i)
if fname == ''
break
endif
! exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":<tab>".fname." :call <SID>DeleteMacro('".fname."')<CR>"
! exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":<tab>".fname." :call <SID>EditMacro('".fname."')<CR>"
! exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." <C-r>=<SID>ReadMacro('".fname."')<CR>"
! exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." i<C-r>=<SID>ReadMacro('".fname."')<CR>"
let i = i + 1
endwhile
***************
*** 38,50 ****
" }}}
" NewMacro: opens new file in macros directory {{{
! function! <SID>NewMacro()
! exe "cd ".s:path."/macros"
! new
! set filetype=tex
endfunction
" }}}
" RedrawMacro: refreshes macro menu {{{
! function! <SID>RedrawMacro()
aunmenu TeX-Suite.Macros
call <SID>SetCustomMacrosMenu()
--- 50,65 ----
" }}}
" NewMacro: opens new file in macros directory {{{
! function! <SID>NewMacro(newmacro)
! if Tex_FileInRtp(a:newmacro, 'macros') != ''
! exe "echomsg 'Macro with name '".a:newmacro."' exists. Try another one.'"
! return
! endif
! exe 'split '.s:macrodirpath.a:newmacro
! setlocal filetype=tex
endfunction
" }}}
" RedrawMacro: refreshes macro menu {{{
! function! RedrawMacro()
aunmenu TeX-Suite.Macros
call <SID>SetCustomMacrosMenu()
***************
*** 55,67 ****
" " Description:
function! s:ChooseMacro(ask)
! let pwd = getcwd()
! exe 'cd '.s:path.'/macros'
let filename = Tex_ChooseFromPrompt(
\ a:ask."\n" .
! \ Tex_CreatePrompt(glob('*'), 2, "\n") .
\ "\nEnter number or filename :",
! \ glob('*'), "\n")
! exe 'cd '.pwd
! endfunction " }}}
" DeleteMacro: deletes macro file {{{
function! <SID>DeleteMacro(...)
--- 70,82 ----
" " Description:
function! s:ChooseMacro(ask)
! let filelist = Tex_FileInRtp('', 'macros')
let filename = Tex_ChooseFromPrompt(
\ a:ask."\n" .
! \ Tex_CreatePrompt(filelist, 2, ',') .
\ "\nEnter number or filename :",
! \ filelist, ',')
! endfunction
!
! " }}}
" DeleteMacro: deletes macro file {{{
function! <SID>DeleteMacro(...)
***************
*** 69,84 ****
let filename = a:1
else
- let pwd = getcwd()
- exe 'cd '.s:path.'/macros'
let filename = s:ChooseMacro('Choose a macro file for deletion :')
- exe 'cd '.pwd
endif
! let ch = confirm('Really delete '.filename.' ?',
! \"Yes\nNo", 2)
! if ch == 1
! call delete(s:path.'/macros/'.filename)
endif
- call s:RedrawMacro()
endfunction
--- 84,102 ----
let filename = a:1
else
let filename = s:ChooseMacro('Choose a macro file for deletion :')
endif
! " Remove only if filename is in local directory
! if !filereadable(s:macrodirpath.filename)
! call confirm('This file is not in your local directory: '.filename."\n".
! \ 'It will not be deleted.' , '&OK', 1)
!
! else
! let ch = confirm('Really delete '.filename.' ?', "&Yes\n&No", 2)
! if ch == 1
! call delete(s:macrodirpath.filename)
! endif
! call RedrawMacro()
endif
endfunction
***************
*** 89,101 ****
let filename = a:1
else
- let pwd = getcwd()
- exe 'cd '.s:path.'/macros'
let filename = s:ChooseMacro('Choose a macro file for insertion:')
- exe 'cd '.pwd
endif
! exe "split ".s:path."/macros/".filename
! exe "lcd ".s:path."/macros/"
! set filetype=tex
endfunction
--- 107,129 ----
let filename = a:1
else
let filename = s:ChooseMacro('Choose a macro file for insertion:')
endif
! if filereadable(s:macrodirpath.filename)
! exe 'split '.s:macrodirpath.filename
! else
! let ch = confirm("You are trying to edit file which is probably read-only.\n".
! \ "It will be copied to your local LaTeX-Suite macros directory\n".
! \ "and you will be operating on local copy with suffix -local.\n".
! \ "It will succeed only if ftplugin/latex-suite/macros dir exists.\n".
! \ "Do you agree?", "&Yes\n&No", 1)
! if ch == 1
! new
! exe '0read '.Tex_FileInRtp(filename, 'macros')
! exe 'write '.s:macrodirpath.filename.'-local'
! endif
!
! endif
! setlocal filetype=tex
endfunction
***************
*** 108,118 ****
let filename = a:1
else
! let pwd = getcwd()
! exe 'cd '.s:path.'/macros'
! let filename = s:ChooseMacro('Choose a macro file for insertion:')
! exe 'cd '.pwd
endif
! let fname = s:path.'/macros/'.filename
let markerString = '<---- Latex Suite End Macro ---->'
--- 136,148 ----
let filename = a:1
else
! let filelist = Tex_FileInRtp('', 'macros')
! let filename =
! \ Tex_ChooseFromPrompt("Choose a macro file:\n" .
! \ Tex_CreatePrompt(filelist, 2, ',') .
! \ "\nEnter number or name of file :",
! \ filelist, ',')
endif
! let fname = Tex_FileInRtp(filename, 'macros')
let markerString = '<---- Latex Suite End Macro ---->'
***************
*** 141,148 ****
" }}}
" commands for macros {{{
! com! -nargs=? TMacro :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR>
! com! -nargs=0 TMacroNew :call <SID>NewMacro()
! com! -nargs=? TMacroEdit :call <SID>EditMacro(<f-args>)
! com! -nargs=? TMacroDelete :call <SID>DeleteMacro(<f-args>)
" }}}
--- 171,206 ----
" }}}
" commands for macros {{{
! com! -nargs=1 TMacroNew :call <SID>NewMacro(<f-args>)
!
! " This macros had to have 2 versions:
! if v:version >= 602
! com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacro
! \ :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR>
! com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroEdit
! \ :call <SID>EditMacro(<f-args>)
! com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroDelete
! \ :call <SID>DeleteMacro(<f-args>)
!
! " 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')
! return macronames
! endfunction
!
! " }}}
!
! else
! com! -nargs=? TMacro
! \ :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR>
! com! -nargs=? TMacroEdit :call <SID>EditMacro(<f-args>)
! com! -nargs=? TMacroDelete :call <SID>DeleteMacro(<f-args>)
!
! endif
" }}}
|