[Vim-latex-cvs] vimfiles/ftplugin/latex-suite brackets.vim,1.1,1.2
Brought to you by:
srinathava,
tmaas
From: <sri...@us...> - 2004-07-21 19:01:32
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32581 Modified Files: brackets.vim Log Message: Bug: The bracketing maps <M-[bcl]> only worked on the first buffer which triggers latex-suite. Why: Initially brackets.vim resided in ftplugin/tex/, where it got sourced every time, but when it was moved to ftplugin/latex-suite, where it gets sourced only once. Fix: Catch the LatexSuiteFileType event Index: brackets.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/brackets.vim,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** brackets.vim 25 Jan 2004 21:48:17 -0000 1.1 --- brackets.vim 21 Jul 2004 19:01:03 -0000 1.2 *************** *** 39,88 **** let b:did_brackets = 1 - " ============================================================================== - " Insert mode mappings - " All the insert mode mappings check to see if the function they are creating - " the map for already exists in the rhs of some map. - " ============================================================================== - " {{{ - - " Provide <plug>'d mapping for easy user customization. - " - inoremap <silent> <Plug>Tex_MathBF <C-r>=Tex_MathBF()<CR> - inoremap <silent> <Plug>Tex_MathCal <C-r>=Tex_MathCal()<CR> - inoremap <silent> <Plug>Tex_LeftRight <C-r>=Tex_LeftRight()<CR> - - " Provide mappings only if the user hasn't provided a map already or if the - " target lhs doesn't have a mapping. - " TODO: These will be removed in future revisions. Alt mappings are a headache - " for European users... - if !hasmapto('<Plug>Tex_MathBF', 'i') && mapcheck('<M-b>', 'i') == '' - imap <buffer> <silent> <M-b> <Plug>Tex_MathBF - endif - if !hasmapto('<Plug>Tex_MathCal', 'i') && mapcheck('<M-c>', 'i') == '' - imap <buffer> <silent> <M-c> <Plug>Tex_MathCal - endif - if !hasmapto('<Plug>Tex_LeftRight', 'i') && mapcheck('<M-l>', 'i') == '' - imap <buffer> <silent> <M-l> <Plug>Tex_LeftRight - endif - " }}} - - " ============================================================================== - " Visual/Normal Mode mappings. - " ============================================================================== - " {{{ - - vnoremap <buffer> <silent> <M-b> <C-C>`>a}<Esc>`<i\mathbf{<Esc> - vnoremap <buffer> <silent> <M-c> <C-C>`>a}<Esc>`<i\mathcal{<Esc> - nnoremap <buffer> <silent> <M-l> :call <SID>PutLeftRight()<CR> - - " }}} - - " ============================================================================== - " Function definitions - " ============================================================================== " define the funtions only once. if exists('*Tex_MathBF') finish endif " Tex_MathBF: encloses te previous letter/number in \mathbf{} {{{ " Description: --- 39,47 ---- let b:did_brackets = 1 " define the funtions only once. if exists('*Tex_MathBF') finish endif + " Tex_MathBF: encloses te previous letter/number in \mathbf{} {{{ " Description: *************** *** 156,158 **** --- 115,145 ---- endfunction " }}} + " Provide <plug>'d mapping for easy user customization. {{{ + inoremap <silent> <Plug>Tex_MathBF <C-r>=Tex_MathBF()<CR> + inoremap <silent> <Plug>Tex_MathCal <C-r>=Tex_MathCal()<CR> + inoremap <silent> <Plug>Tex_LeftRight <C-r>=Tex_LeftRight()<CR> + vnoremap <silent> <Plug>Tex_MathBF <C-C>`>a}<Esc>`<i\mathbf{<Esc> + vnoremap <silent> <Plug>Tex_MathCal <C-C>`>a}<Esc>`<i\mathcal{<Esc> + nnoremap <silent> <Plug>Tex_LeftRight :call Tex_PutLeftRight()<CR> + + " }}} + " Tex_SetBracketingMaps: create mappings for the current buffer {{{ + function! <SID>Tex_SetBracketingMaps() + + call Tex_MakeMap('<M-b>', '<Plug>Tex_MathBF', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-c>', '<Plug>Tex_MathCal', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-l>', '<Plug>Tex_LeftRight', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-b>', '<Plug>Tex_MathBF', 'v', '<buffer> <silent>') + call Tex_MakeMap('<M-c>', '<Plug>Tex_MathCal', 'v', '<buffer> <silent>') + call Tex_MakeMap('<M-l>', '<Plug>Tex_LeftRight', 'n', '<buffer> <silent>') + + endfunction + " }}} + + augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('brackets.vim: Catching LatexSuiteFileType event', 'brak') | + \ call <SID>Tex_SetBracketingMaps() + augroup END + " vim:fdm=marker |