Update: you *can* make more complex mappings.  In this case, I've made
a robust object map for lp.  It works in both object-pending or visual
mode.  Here is the code in my ~/.vim/ftplugin/tex.vim:

" Section: Paragraph formatting (autofill) {{{
" Correctly format paragraphs in LaTeX.
" The exec command should be one line: watch out if the e-mail client
" or server inserts any line breaks.
function! g:Tex_SelectParagraph ()
        exec "normal 
?^$\\|^\s*\\(\\\\begin\\|\\\\end\\|\\\\renewcommand\\|\\\\label\\|\\\\item\\)?1\<cr>v//-1\<cr>$"
endfunction
omap <buffer> lp :call g:Tex_SelectParagraph()<cr>
vmap <buffer> lp <esc>:call g:Tex_SelectParagraph()<cr>
" }}}


Now you can use ylp, dlp, clp, vlp, etc.

I plan to make additional ones for "in environment", "an environment",
"an equation", and more.  For more info on how this works, check out
:h omap-info.

Mike Richman

On Wed, Jan 7, 2009 at 6:55 PM, Manuel Pégourié-Gonnard <m...@elzevir.fr> wrote:
> Hi Mike,
>
> Mike Richman a écrit :
>> Basically, gwlp will reformat the current paragraph until it reaches a
>> blank line or a begin or end of environment or a label or an item
>> command.  This way gwlp won't mess up your math, but your text will
>> still be formatted correctly.
>>
> OMG! I've been looking for this for sooooo long! Thanks a lot.
>
> I guess the culprit is that omap defines new "objects". Is is possible
> possible to define objects like "e" for environment such that ae means
> the whole environment including the \begin and \end lines, and ie just
> the body?
>
> I'll test it tomorrow, and try to understand how it works, and maybe
> come back with a few more questions.
>
> Thanks again,
> Manuel.
>
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Vim-latex-devel mailing list
Vim-latex-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vim-latex-devel

Reply via email to