Update of /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite
In directory sc8-pr-cvs1:/tmp/cvs-serv11641
Modified Files:
envmacros.vim ChangeLog
Log Message:
Johannes Tanzlers InsertItem function - insert item depending on environment
Index: envmacros.vim
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/envmacros.vim,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** envmacros.vim 13 Sep 2003 07:06:41 -0000 1.36
--- envmacros.vim 10 Oct 2003 07:16:36 -0000 1.37
***************
*** 868,872 ****
--- 868,906 ----
endif
endfunction " }}}
+ " ==============================================================================
+ " Contributions / Tex_InsertItem() from Johannes Tanzler
+ " ==============================================================================
+ " Tex_InsertItem: insert \item into a list {{{
+ " Description: Find last \begin line, extract env name, return to the start
+ " position and insert proper \item, depending on env name.
+ " 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')
+ let env = matchstr(getline(env_line), '\\begin{\zs.\{-}\ze}')
+ 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
Index: ChangeLog
===================================================================
RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/ChangeLog,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ChangeLog 29 Sep 2003 02:23:49 -0000 1.12
--- ChangeLog 10 Oct 2003 07:16:36 -0000 1.13
***************
*** 1,2 ****
--- 1,8 ----
+ 10 Oct 2003
+ Features
+ * envmacros.vim:
+ Tex_InsertItem function. Inserts \item depending on current listing
+ directory. (Johannes Tanzler, MM)
+
29 Sep 2003
Changes
|