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

Re: Justify.vim

Expand Messages
  • c928400@student.dtu.dk
    [Sorry about the duplicate Alexander, forgot vim-dev, please respond there too] ... Just popping in as the author here... In justify.vim near the end you will
    Message 1 of 5 , Nov 1, 2000
    • 0 Attachment
      [Sorry about the duplicate Alexander, forgot vim-dev, please respond
      there too]

      Thus wrote Alexander Wagner (A.Wagner@...) on [001101]:

      > Hi!

      > Don't know if this is a 6.0k issue or a justify-issue anyway
      > maybe there's some solution arround. Justify doesn't like
      > some characters. Something wired happesn if I try to
      > justify text that contains e.g. the string "AT&T". As you
      > may see here:

      > -----------------------------------------
      > Don't know if this is a 6.0k issue or a justify-issue anyway
      > maybe there's some solution arround. Justify doesn't like
      > some characters. Something wired happesn if I try to
      > justify text that contains e.g. the string "ATjustify text that contains e.g. the string "AT&T". As youT". As you
      > may see here:
      > ----------------------------------------

      Just popping in as the author here...

      In justify.vim near the end you will find the following lines:

      " Replace the line (brings the cursor to the line)
      let str = substitute( str, '\\', '\\\\', 'g')
      let str = substitute( str, '/', '\\/', 'g')
      let str = substitute( str, '\~', '\\\~', 'g')
      exec cur . 's/.*/' . str . '/'

      Try changing that to:

      " Replace the line (brings the cursor to the line)
      setline(cur, str)

      I don't have vim here (and a broken compiler :-( ), so I cannot test
      it myself.

      I don't know why setline() was not used in the first place, but the
      script is a couple of years old by now, so perhaps it was not even in
      vim then (along those lines, the three substitute()'s above should be
      escape()'s by now).

      I hope this does the trick,

      Peppe
    • DouglasPotts@spectral-sys.com
      From the looks of things, I assume that the & is getting expanded to: magic nomagic action ~ & & replaced with the whole matched pattern see
      Message 2 of 5 , Nov 1, 2000
      • 0 Attachment
        From the looks of things, I assume that the '&' is getting expanded to:

        magic nomagic action ~
        & \& replaced with the whole matched pattern

        see :h sub-replace-special
        -Doug

        --
        *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
        Douglas L. Potts Spectral Systems, Inc. Url: http://www.bigfoot.com/~pottsdl
        "The Matrix is everywhere, it's all around us, here even in this room. You can
        see it out your window, or on your television. You feel it when you go to work,
        or go to church or pay your taxes. It is the world that has been pulled over
        your eyes to blind you from the truth... Unfortunately, no one can be told what
        the Matrix is. You have to see it for yourself. ~Morpheus "- from The Matrix
        *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*



        "Alexander
        Wagner" To: "vim-dev" <vim-dev@...>
        <A.Wagner@Big cc:
        foot.de> Subject: Justify.vim

        11/01/00
        10:26 AM
        Please
        respond to
        "Alexander
        Wagner"






        Hi!

        Don't know if this is a 6.0k issue or a justify-issue anyway
        maybe there's some solution arround. Justify doesn't like
        some characters. Something wired happesn if I try to
        justify text that contains e.g. the string "AT&T". As you
        may see here:

        -----------------------------------------
        Don't know if this is a 6.0k issue or a justify-issue anyway
        maybe there's some solution arround. Justify doesn't like
        some characters. Something wired happesn if I try to
        justify text that contains e.g. the string "ATjustify text that contains
        e.g. the string "AT&T". As youT". As you
        may see here:
        ----------------------------------------




        --

        CU/2 (( In the beginning was The Word.
        Alexander Wagner )) And The Word was Content-type: text/plain
        Team OS/2 Franken (( -=[ Team OS/2 Germany #294 ]=-
        -----------------------------------------------------------------
        Please use only A.Wagner@... or A.Wagner@... for
        replies, even if some other addresses may appear. Thanks!
        --> Get my PGP-key with Subject: Request for PGP-Keys <--
      • c928400@student.dtu.dk
        ... Most welcome! It is always nice to know, that someone uses my script(s). ... Args! make that call setline(cur, str) exec line(cur) ... A bug is a bug...
        Message 3 of 5 , Nov 1, 2000
        • 0 Attachment
          Thus wrote Alexander Wagner (A.Wagner@...) on [001101]:
          > On Wed, 1 Nov 2000 18:58:11 +0100, c928400@... wrote:

          > Hi!

          > > Just popping in as the author here...

          > Thanks for that nice scirpt!

          Most welcome! It is always nice to know, that someone uses my
          script(s).

          > > " Replace the line (brings the cursor to the line)
          > > setline(cur, str)

          > This is what vim (6.0k alpha) said:

          > Error detected while processing function Justify:
          > line 151:
          > Not an editor command: setline(cur, str)

          Args! make that

          call setline(cur, str)
          exec line(cur)

          > BTW: I came across a minor issue when using blockquotes.
          > Sometimes your script counts a space at the end of a line as
          > char. So instead filling in an additional space within the
          > line it leaves the line one char to short. As it's only
          > cosmitics it's not "mission critical". Just FYI.

          A bug is a bug... :-)

          Can you provide me with an example where this happens?

          As all whitespace at end of line is stripped, I think it must be in
          the adjustment of the number of spaces in the line.

          Thanks for pointing out these errors.

          Peppe
        • c928400@student.dtu.dk
          ... Indeed, not enough characters were escaped (in the old way of doing things). I also fixed problems with leading tabs and missing characters with
          Message 4 of 5 , Nov 3, 2000
          • 0 Attachment
            Thus wrote Alexander Wagner (A.Wagner@...) on [001101]:

            > Hi!

            > Don't know if this is a 6.0k issue or a justify-issue anyway
            > maybe there's some solution arround. Justify doesn't like
            > some characters. Something wired happesn if I try to
            > justify text that contains e.g. the string "AT&T". As you
            > may see here:

            Indeed, not enough characters were escaped (in the old way of doing
            things).

            I also fixed problems with leading tabs and missing characters with
            'joinspaces' set (calculations were wrong).

            Attached is the new version, that should replace
            $VIMRUNTIME/macros/justify.vim

            Peppe
          Your message has been successfully submitted and would be delivered to recipients shortly.