Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv6287
Modified Files:
custommacros.vim
Log Message:
Polishing if custommacros.vim system-local implementation.
No need for "Argument required" error:
Handling of menu call (fake argument FFFromMMMenu).
Better handling of possible error situations - prompt for name.
Index: custommacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/custommacros.vim,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** custommacros.vim 28 Sep 2003 22:53:38 -0000 1.15
--- custommacros.vim 29 Sep 2003 00:43:44 -0000 1.16
***************
*** 19,23 ****
let s:macrodirpath = $HOME."/vimfiles/ftplugin/latex-suite/macros/"
else
! let s:macrodirpath = $VIMRUNTIME."/ftplugin/latex-suite/macros/"
endif
endif
--- 19,23 ----
let s:macrodirpath = $HOME."/vimfiles/ftplugin/latex-suite/macros/"
else
! let s:macrodirpath = $VIM."/vimfiles/ftplugin/latex-suite/macros/"
endif
endif
***************
*** 27,31 ****
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>'
--- 27,31 ----
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>'
***************
*** 50,59 ****
" }}}
" 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
--- 50,81 ----
" }}}
" NewMacro: opens new file in macros directory {{{
! function! <SID>NewMacro(...)
! " Allow for calling :TMacroNew without argument or from menu and prompt
! " for name.
! if a:0 > 0
! let newmacroname = a:1
! else
! let newmacroname = input("Name of new macro: ")
! if newmacroname == ''
! return
! endif
endif
!
! if newmacroname == "FFFromMMMenu"
! " Check if NewMacro was called from menu and prompt for insert macro
! " name
! let newmacroname = input("Name of new macro: ")
! if newmacroname == ''
! 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.'"
! let newmacroname = input("Name of new macro: ")
! if newmacroname == ''
! return
! endif
! endif
! exe 'split '.s:macrodirpath.newmacroname
setlocal filetype=tex
endfunction
***************
*** 171,175 ****
" }}}
" commands for macros {{{
! com! -nargs=1 TMacroNew :call <SID>NewMacro(<f-args>)
" This macros had to have 2 versions:
--- 193,197 ----
" }}}
" commands for macros {{{
! com! -nargs=? TMacroNew :call <SID>NewMacro(<f-args>)
" This macros had to have 2 versions:
|