Thread: [Vim-latex-cvs] vimfiles/ftplugin/latex-suite envmacros.vim,1.17,1.18
Brought to you by:
srinathava,
tmaas
From: <mi...@us...> - 2003-01-09 15:31:47
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite In directory sc8-pr-cvs1:/tmp/cvs-serv18252 Modified Files: envmacros.vim Log Message: - <F5> key works for environments also in visual mode Only for environments, in preamble <F5> is ignored. - :g/Last Change/s/.*/" CVS Header: $Header$/ Index: envmacros.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** envmacros.vim 5 Jan 2003 08:36:17 -0000 1.17 --- envmacros.vim 9 Jan 2003 15:31:36 -0000 1.18 *************** *** 3,8 **** " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " Last Change: Sun Jan 05 12:00 AM 2003 PST ! " " Description: mappings/menus for environments. "============================================================================= --- 3,8 ---- " Author: Mikolaj Machowski " Created: Tue Apr 23 08:00 PM 2002 PST ! " CVS Header: ! " $Header$ " Description: mappings/menus for environments. "============================================================================= *************** *** 571,590 **** " Based on input argument, it calls various specialized functions. function! Tex_PutEnvironment(env) ! if a:env =~ "equation*\\|eqnarray*\\|align*\\|theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" ! return Tex_eqnarray(a:env) ! elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" ! return Tex_itemize(a:env) ! elseif a:env =~ "table\\|table*" ! return Tex_table(a:env) ! elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" ! return Tex_tabular(a:env) ! elseif exists('*Tex_'.a:env) ! exe 'return Tex_'.a:env.'(a:env)' ! elseif a:env == '$$' ! return IMAP_PutTextWithMovement('$$<++>$$') ! elseif a:env == '[' ! return IMAP_PutTextWithMovement("\\[\<CR><++>\<CR>\\]<++>") else ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr><++>\<cr>\\end{".a:env."}<++>") endif endfunction " }}} --- 571,594 ---- " Based on input argument, it calls various specialized functions. function! Tex_PutEnvironment(env) ! if s:isvisual == "yes" ! return VEnclose('\begin{'.a:env.'}', '\end{'.a:env.'}', '\begin{'.a:env.'}', '\end{'.a:env.'}') else ! if a:env =~ "equation*\\|eqnarray*\\|align*\\|theorem\\|lemma\\|equation\\|eqnarray\\|align\\|multline" ! return Tex_eqnarray(a:env) ! elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" ! return Tex_itemize(a:env) ! elseif a:env =~ "table\\|table*" ! return Tex_table(a:env) ! elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" ! return Tex_tabular(a:env) ! elseif exists('*Tex_'.a:env) ! exe 'return Tex_'.a:env.'(a:env)' ! elseif a:env == '$$' ! return IMAP_PutTextWithMovement('$$<++>$$') ! elseif a:env == '[' ! return IMAP_PutTextWithMovement("\\[\<CR><++>\<CR>\\]<++>") ! else ! return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr><++>\<cr>\\end{".a:env."}<++>") ! endif endif endfunction " }}} *************** *** 602,609 **** " Provide only <plug>s here. main.vim will create the actual maps. ! inoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-r>=Tex_FastEnvironmentInsert()<cr> ! nnoremap <silent> <Plug>Tex_FastEnvironmentInsert i<C-r>=Tex_FastEnvironmentInsert()<cr> ! inoremap <silent> <Plug>Tex_FastEnvironmentChange <C-O>:call Tex_ChangeEnvironments()<CR> ! nnoremap <silent> <Plug>Tex_FastEnvironmentChange :call Tex_ChangeEnvironments()<CR> " Tex_FastEnvironmentInsert: maps <F5> to prompt for env and insert it " {{{ --- 606,614 ---- " Provide only <plug>s here. main.vim will create the actual maps. ! inoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-r>=Tex_FastEnvironmentInsert("no")<cr> ! nnoremap <silent> <Plug>Tex_FastEnvironmentInsert i<C-r>=Tex_FastEnvironmentInsert("no")<cr> ! inoremap <silent> <Plug>Tex_FastEnvironmentChange <C-O>:call Tex_ChangeEnvironments("no")<CR> ! nnoremap <silent> <Plug>Tex_FastEnvironmentChange :call Tex_ChangeEnvironments("no")<CR> ! vnoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-\><C-N>:call Tex_FastEnvironmentInsert("yes")<CR> " Tex_FastEnvironmentInsert: maps <F5> to prompt for env and insert it " {{{ *************** *** 615,622 **** " current line or prompting the user to choose one. " ! function! Tex_FastEnvironmentInsert() let start_line = line('.') let pos = line('.').' | normal! '.virtcol('.').'|' " decide if we are in the preamble of the document. If we are then --- 620,628 ---- " current line or prompting the user to choose one. " ! function! Tex_FastEnvironmentInsert(isvisual) let start_line = line('.') let pos = line('.').' | normal! '.virtcol('.').'|' + let s:isvisual = a:isvisual " decide if we are in the preamble of the document. If we are then *************** *** 666,673 **** function! Tex_package_from_line() " Function Tex_PutPackage is defined in packages.vim ! let l = getline(".") ! let pack = matchstr(l, '^\s*\zs.*') ! normal! 0"_D ! return Tex_pack_one(pack) endfunction --- 672,684 ---- function! Tex_package_from_line() " Function Tex_PutPackage is defined in packages.vim ! " Ignores <F5> in Visual mode ! if s:isvisual == "yes" ! return 0 ! else ! let l = getline(".") ! let pack = matchstr(l, '^\s*\zs.*') ! normal! 0"_D ! return Tex_pack_one(pack) ! endif endfunction *************** *** 838,841 **** --- 849,855 ---- if !hasmapto('<Plug>Tex_FastEnvironmentChange', 'n') nmap <silent> <buffer> <S-F5> <Plug>Tex_FastEnvironmentChange + endif + if !hasmapto('<Plug>Tex_FastEnvironmentInsert', 'v') + vmap <silent> <buffer> <F5> <Plug>Tex_FastEnvironmentInsert endif endif |