[Vim-latex-cvs] vimfiles/ftplugin/latex-suite envmacros.vim,1.37,1.38
Brought to you by:
srinathava,
tmaas
|
From: <sri...@us...> - 2003-10-23 02:32:05
|
Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv17776
Modified Files:
envmacros.vim
Log Message:
Fix: Tex_thebibliography did not use the Tex_UseMenuWizard setting.
Thus <F5> completion would always ask some questions.
Change: A little change to the Tex_InsertItem() function and the way the
styles for the various environments are done. In the present way,
we define global variables of the form:
g:Tex_ItemStyle_thebibliography =
\ '\item[<+biblabel+>]{<+bibkey+>} '
This is more flexible than the old approach because this way, the
item style can be arbitrarily complex instead of being limited to
one of four styles.
Index: envmacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** envmacros.vim 10 Oct 2003 07:16:36 -0000 1.37
--- envmacros.vim 23 Oct 2003 01:45:39 -0000 1.38
***************
*** 490,504 ****
" Tex_thebibliography: {{{
function! Tex_thebibliography(env)
! " AUC Tex: "Label for BibItem: 99"
! let indent = input('Indent for BibItem? ')
! let foo = '{'.indent.'}'
! let biblabel = input('(Optional) Bibitem label? ')
! let key = input('Add key? ')
! let bar = '\bibitem'
! if biblabel != ''
! let bar = bar.'['.biblabel.']'
! endif
! let bar = bar.'{'.key.'}'
! return IMAP_PutTextWithMovement('\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}<++>\<Up>")
endfunction
" }}}
--- 490,508 ----
" Tex_thebibliography: {{{
function! Tex_thebibliography(env)
! if g:Tex_UseMenuWizard == 1
! " AUC Tex: "Label for BibItem: 99"
! let indent = input('Indent for BibItem? ')
! let foo = '{'.indent.'}'
! let biblabel = input('(Optional) Bibitem label? ')
! let key = input('Add key? ')
! let bar = '\bibitem'
! if biblabel != ''
! let bar = bar.'['.biblabel.']'
! endif
! let bar = bar.'{'.key.'}'
! return IMAP_PutTextWithMovement('\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}<++>\<Up>")
! else
! return IMAP_PutTextWithMovement("\\begin{thebibliography}\<CR><++>\<CR>\\end{thebibliography}<++>")
! endif
endfunction
" }}}
***************
*** 868,871 ****
--- 872,876 ----
endif
endfunction " }}}
+
" ==============================================================================
" Contributions / Tex_InsertItem() from Johannes Tanzler
***************
*** 876,885 ****
" Env names are stored in g: variables it can be used by
" package files.
- let g:Tex_ItemNormal = ',itemize,enumerate,theindex,'
- let g:Tex_ItemBib = ',thebibliography,'
- let g:Tex_ItemDescription = ',description,'
- function! Tex_InsertItem()
! " Get current environment:
let pos = line('.').' | normal! '.virtcol('.').'|'
let env_line = search('^[^%]*\\begin{', 'bW')
--- 881,893 ----
" Env names are stored in g: variables it can be used by
" package files.
! TexLet g:Tex_ItemStyle_itemize = '\item '
! TexLet g:Tex_ItemStyle_enumerate = '\item '
! TexLet g:Tex_ItemStyle_theindex = '\item '
! TexLet g:Tex_ItemStyle_thebibliography = '\item[<+biblabel+>]{<+bibkey+>} '
! TexLet g:Tex_ItemStyle_description = '\item[<+lablel+>] '
!
! function! Tex_InsertItem()
! " Get current enclosing environment
let pos = line('.').' | normal! '.virtcol('.').'|'
let env_line = search('^[^%]*\\begin{', 'bW')
***************
*** 887,906 ****
exe pos
! if g:Tex_ItemNormal =~ ','.env.','
! return IMAP_PutTextWithMovement("\\item ")
! elseif g:Tex_ItemDescription =~ ','.env.','
! return IMAP_PutTextWithMovement("\\item[<+label+>] <++>")
! elseif g:Tex_ItemBib =~ ','.env.','
! return IMAP_PutTextWithMovement("\\item[<+biblabel+>]{<+bibkey+>}<++>")
! else
! return ''
! endif
!
endfunction
! inoremap <C-CR> <ESC>o<C-R>=Tex_InsertItem()<CR>
! inoremap <Leader>it <C-R>=Tex_InsertItem()<CR>
- " }}}
" ==============================================================================
" Implementation of Fast Environment commands for LaTeX commands
--- 895,921 ----
exe pos
! if exists('g:Tex_ItemStyle_'.env)
! return IMAP_PutTextWithMovement(g:Tex_ItemStyle_{env})
! else
! return ''
! endif
endfunction
+ " }}}
+ " Tex_SetItemMaps: sets the \item inserting maps for current buffer {{{
+ " Description:
! inoremap <script> <silent> <Plug>Tex_InsertItemOnThisLine <Esc>a<C-r>=Tex_InsertItem()<CR>
! inoremap <script> <silent> <Plug>Tex_InsertItemOnNextLine <ESC>o<C-R>=Tex_InsertItem()<CR>
!
! function! Tex_SetItemMaps()
! if !hasmapto("\<Plug>Tex_InsertItem")
! imap <buffer> <Leader>it <Plug>Tex_InsertItemOnThisLine
! imap <buffer> <M-i> <Plug>Tex_InsertItemOnThisLine
! endif
! if !hasmapto("\<Plug>Tex_InsertItemOnNextLine")
! imap <buffer> <C-CR> <Plug>Tex_InsertItemOnNextLine
! endif
! endfunction " }}}
" ==============================================================================
" Implementation of Fast Environment commands for LaTeX commands
***************
*** 1095,1098 ****
--- 1110,1114 ----
call Tex_SetFastCommandMaps()
endif
+ call Tex_SetItemMaps()
endfunction " }}}
" Catch the Filetype event so we set maps for each buffer {{{
|