Keep in mind that any "movement" can follow those g commands. So even if your the Tex_SelectParagraph you choose doesn't fit the weird case you're dealing with at this instant, you can probably build a quick regexp by inspection that will.
For example, if a \ is coming up on the start of the next line, something like gw/^\\ will apply a gw up to the line just before it. --Ted On 1/8/09 4:11 AM, Julien Cornebise wrote: > Wow, thanks for all these informations ! That will be really useful, > right now !! > Thanks ! > > On Thu, Jan 8, 2009 at 4:23 AM, Mike Richman<rich...@umd.edu> wrote: >> 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 > -- Ted Pavlic <t...@tedpavlic.com> Please visit my ALS association page: http://web.alsa.org/goto/tedpavlic My family appreciates your support in the fight to defeat ALS. ------------------------------------------------------------------------------ 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