Loading ...
Sorry, an error occurred while loading the content.

136140Re: Using auto-format with LaTeX

Expand Messages
  • Bram Moolenaar
    Feb 14, 2013
      Christian Brabandt wrote:

      > Hi Marcin!
      >
      > On So, 10 Feb 2013, Marcin Szamotulski wrote:
      >
      > > On 12:19 Sat 09 Feb , Zyad wrote:
      > > > Hi,
      > > >
      > > > I'm finding the auto-format option very attractive (setl fo+=a), but I'm having trouble getting it to work nicely when editing LaTeX documents.
      > > >
      > > > More specifically, I'd like to make it aware of LaTeX keywords so that, for example, when writing the following,
      > > >
      > > > This is a paragraph that is properly
      > > > formatted to have a textwidth of 40.
      > > > 'auto-format' helps maintain it in a
      > > > formatted form, even if I edit parts of
      > > > it.
      > > > \begin{equation}
      > > > z^2 = x^2 + y^2
      > > > \end{equation
      > > >
      > > > as soon as I enter '\', the cursor moves to the previous line. Is it possible to have auto-format understand that a keyword like '\begin{' should not be considered part of the paragraph before it? I'm aware of formatoptions' 'w' flag, but it is inconvenient for me since the document is usually edited by others.
      > > >
      > > > Thanks,
      > > > Zyad
      > >
      > > The problem is that vim the 'paragraphs' setting accepts only nroff
      > > macros. ATP (http://atp-vim.sf.net) defined a map gW which detects
      > > paragraphs and formats them - it is still not what you (and me) wanted
      > > but it a bit better.
      >
      > Personally, I have never used nroff macros and I think the 'paragraphs'
      > and 'sections' setttings are pretty useless, if you can't use regular
      > expressions.
      >
      > Does anything speak against having a special casing of the 'paragraphs'
      > and 'sections' option to use a regular expression pattern to test
      > against if it starts with a '/'?
      >
      > Attached is a toy patch.

      It's an idea. Several users have asked for a more flexible way to
      define paragraph boundaries.

      I think the help needs some more work. How is the regular expression
      used? What if a two-character part before it already matched?
      An example would be helpful.


      --
      A disclaimer for the disclaimer:
      "and before I get a huge amount of complaints , I have no control over the
      disclaimer at the end of this mail :-)" (Timothy Aldrich)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 6 messages in this topic