[Vim-latex-cvs] vimfiles/ftplugin/latex-suite custommacros.vim,1.14,1.14.4.1
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2003-11-07 06:37:15
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv31133 Modified Files: Tag: release-1-5 custommacros.vim Log Message: Change: Make function names consistent with naming convention (adding prefix Tex_). Fix: TMacro without arguments did not insert contents of the macro into the file. Index: custommacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/custommacros.vim,v retrieving revision 1.14 retrieving revision 1.14.4.1 diff -C2 -d -r1.14 -r1.14.4.1 *** custommacros.vim 19 Jul 2003 07:05:47 -0000 1.14 --- custommacros.vim 7 Nov 2003 06:37:12 -0000 1.14.4.1 *************** *** 2,7 **** " File: custommacros.vim " Author: Mikolaj Machowski ! " Version: 1.0 ! " Created: Tue Apr 23 05:00 PM 2002 PST " " Description: functions for processing custom macros in the --- 2,6 ---- " File: custommacros.vim " Author: Mikolaj Machowski ! " CVS: $Id$ " " Description: functions for processing custom macros in the *************** *** 11,19 **** 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 --- 10,18 ---- let s:path = expand('<sfile>:p:h') ! " Tex_SetCustomMacrosMenu: sets up the menu for Macros {{{ ! function! Tex_SetCustomMacrosMenu() let flist = glob(s:path."/macros/*") ! exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call Tex_NewMacro()<CR>' ! exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call Tex_RedrawMacro()<CR>' let i = 1 *************** *** 24,31 **** 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 --- 23,30 ---- endif let fnameshort = fnamemodify(fname, ':p:t:r') ! exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":<tab>".fnameshort." :call Tex_DeleteMacro('".fnameshort."')<CR>" ! exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":<tab>".fnameshort." :call Tex_EditMacro('".fnameshort."')<CR>" ! exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fnameshort." <C-r>=Tex_ReadMacro('".fnameshort."')<CR>" ! exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fnameshort." i<C-r>=Tex_ReadMacro('".fnameshort."')<CR>" let i = i + 1 endwhile *************** *** 33,42 **** if g:Tex_Menus ! call <SID>SetCustomMacrosMenu() endif " }}} ! " NewMacro: opens new file in macros directory {{{ ! function! <SID>NewMacro() exe "cd ".s:path."/macros" new --- 32,41 ---- if g:Tex_Menus ! call Tex_SetCustomMacrosMenu() endif " }}} ! " Tex_NewMacro: opens new file in macros directory {{{ ! function! Tex_NewMacro() exe "cd ".s:path."/macros" new *************** *** 45,58 **** " }}} ! " RedrawMacro: refreshes macro menu {{{ ! function! <SID>RedrawMacro() aunmenu TeX-Suite.Macros ! call <SID>SetCustomMacrosMenu() endfunction " }}} ! " ChooseMacro: choose a macro file {{{ ! " " Description: ! function! s:ChooseMacro(ask) let pwd = getcwd() exe 'cd '.s:path.'/macros' --- 44,57 ---- " }}} ! " Tex_RedrawMacro: refreshes macro menu {{{ ! function! Tex_RedrawMacro() aunmenu TeX-Suite.Macros ! call Tex_SetCustomMacrosMenu() endfunction " }}} ! " Tex_ChooseMacro: choose a macro file {{{ ! " Description: ! function! Tex_ChooseMacro(ask) let pwd = getcwd() exe 'cd '.s:path.'/macros' *************** *** 63,69 **** \ glob('*'), "\n") exe 'cd '.pwd endfunction " }}} ! " DeleteMacro: deletes macro file {{{ ! function! <SID>DeleteMacro(...) if a:0 > 0 let filename = a:1 --- 62,70 ---- \ glob('*'), "\n") exe 'cd '.pwd + + return filename endfunction " }}} ! " Tex_DeleteMacro: deletes macro file {{{ ! function! Tex_DeleteMacro(...) if a:0 > 0 let filename = a:1 *************** *** 71,75 **** let pwd = getcwd() exe 'cd '.s:path.'/macros' ! let filename = s:ChooseMacro('Choose a macro file for deletion :') exe 'cd '.pwd endif --- 72,76 ---- let pwd = getcwd() exe 'cd '.s:path.'/macros' ! let filename = Tex_ChooseMacro('Choose a macro file for deletion :') exe 'cd '.pwd endif *************** *** 80,89 **** call delete(s:path.'/macros/'.filename) endif ! call s:RedrawMacro() endfunction " }}} ! " EditMacro: edits macro file {{{ ! function! <SID>EditMacro(...) if a:0 > 0 let filename = a:1 --- 81,90 ---- call delete(s:path.'/macros/'.filename) endif ! call Tex_RedrawMacro() endfunction " }}} ! " Tex_EditMacro: edits macro file {{{ ! function! Tex_EditMacro(...) if a:0 > 0 let filename = a:1 *************** *** 91,95 **** let pwd = getcwd() exe 'cd '.s:path.'/macros' ! let filename = s:ChooseMacro('Choose a macro file for insertion:') exe 'cd '.pwd endif --- 92,96 ---- let pwd = getcwd() exe 'cd '.s:path.'/macros' ! let filename = Tex_ChooseMacro('Choose a macro file for insertion:') exe 'cd '.pwd endif *************** *** 101,107 **** " }}} ! " ReadMacro: reads in a macro from a macro file. {{{ " allowing for placement via placeholders. ! function! <SID>ReadMacro(...) if a:0 > 0 --- 102,108 ---- " }}} ! " Tex_ReadMacro: reads in a macro from a macro file. {{{ " allowing for placement via placeholders. ! function! Tex_ReadMacro(...) if a:0 > 0 *************** *** 110,115 **** let pwd = getcwd() exe 'cd '.s:path.'/macros' ! let filename = s:ChooseMacro('Choose a macro file for insertion:') exe 'cd '.pwd endif --- 111,120 ---- let pwd = getcwd() exe 'cd '.s:path.'/macros' ! let filename = Tex_ChooseMacro('Choose a macro file for insertion:') exe 'cd '.pwd + + if filename == '' + return '' + endif endif *************** *** 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>) " }}} --- 146,153 ---- " }}} " commands for macros {{{ ! com! -nargs=? TMacro :let s:retVal = Tex_ReadMacro(<f-args>) <bar> exec "normal! i\<C-r>=s:retVal<CR>\<right>" <bar> startinsert ! com! -nargs=0 TMacroNew :call Tex_NewMacro() ! com! -nargs=? TMacroEdit :call Tex_EditMacro(<f-args>) ! com! -nargs=? TMacroDelete :call Tex_DeleteMacro(<f-args>) " }}} |