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

Re: Formatting a paragraph in insert mode

Expand Messages
  • A.J.Mechelynck
    ... Thanks! Every day I learn something new. Best regards, Tony.
    Message 1 of 16 , Aug 2, 2006
    • 0 Attachment
      dcuaron@... wrote:
      > Dear Vimmers,
      >
      > I believe you can just do a gwap to leave the cursor in
      > the same position.
      >
      > -dan
      >
      >

      Thanks! Every day I learn something new.


      Best regards,
      Tony.
    • Jürgen Krämer
      Hi, ... Note that the final order of lines with same numbers depends on the whole line -- Lines with more spaces after Line ### | will come out first.
      Message 2 of 16 , Aug 2, 2006
      • 0 Attachment
        Hi,

        Eric Leenman wrote:
        >
        > I have a long file which contains like:
        > ##################################################
        > | 0 1 2 3 4 5 6
        > ##################################################
        > Line 18 | 123
        > Line 19 | abc
        > --------------------------------------------------
        > Line 332 | xyz
        > ##################################################
        > | 0 1 2 3 4 5 6
        > ##################################################
        > Line 18 | 641
        > Line 19 | GHI
        > --------------------------------------------------
        > Line 332 | vcx
        > ##################################################
        > | 0 1 2 3 4 5 6
        > ##################################################
        > ....
        >
        > How do I sort this file so that
        > - all line 18 , i.e., comes under each other? And line 19 , and so on.
        > - removes the lines starting with ###
        > - removes the lines starting with ---
        > - removes the lines starting with spaces
        >
        > So that what remains look like this:
        > ...
        > Line 18 | 123
        > Line 18 | 641
        > Line 19 | abc
        > Line 19 | GHI
        > Line 332 | xyz
        > Line 332 | vcx

        :g/^\(###\|---\| \)d
        :%!sort

        Note that the final order of lines with same numbers depends on the
        whole line -- Lines with more spaces after "Line ### |" will come out
        first.

        Regards,
        Jürgen

        --
        Sometimes I think the surest sign that intelligent life exists elsewhere
        in the universe is that none of it has tried to contact us. (Calvin)
      • Tim Chase
        ... (or, newer versions of vim may have a built-in sort-function, which can be used like ... HTH, -tim
        Message 3 of 16 , Aug 2, 2006
        • 0 Attachment
          > How do I sort this file so that
          > - removes the lines starting with ###

          :g/^###/d

          > - removes the lines starting with ---

          :g/^---/d

          > - removes the lines starting with spaces

          :g/^\s\+/d

          > - all line 18 , i.e., comes under each other? And line 19 , and so on.

          :%!sort

          (or, newer versions of vim may have a built-in sort-function,
          which can be used like

          :%sort


          Those first three commands can be combined, if desired:

          :g/^\(###\|---\|\s\+\)/d

          HTH,

          -tim
        • Eric Leenman
          Thanks, it works Eric ... _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today -
          Message 4 of 16 , Aug 2, 2006
          • 0 Attachment
            Thanks, it works
            Eric


            >From: Tim Chase <vim@...>
            >To: Eric Leenman <eric.leenman@...>
            >CC: vim@...
            >Subject: Re: Sorting a file
            >Date: Wed, 02 Aug 2006 08:44:07 -0500
            >
            >>How do I sort this file so that
            >>- removes the lines starting with ###
            >
            >:g/^###/d
            >
            >>- removes the lines starting with ---
            >
            >:g/^---/d
            >
            >>- removes the lines starting with spaces
            >
            >:g/^\s\+/d
            >
            >>- all line 18 , i.e., comes under each other? And line 19 , and so on.
            >
            >:%!sort
            >
            >(or, newer versions of vim may have a built-in sort-function, which can be
            >used like
            >
            > :%sort
            >
            >
            >Those first three commands can be combined, if desired:
            >
            >:g/^\(###\|---\|\s\+\)/d
            >
            >HTH,
            >
            >-tim
            >
            >
            >
            >
            >

            _________________________________________________________________
            Express yourself instantly with MSN Messenger! Download today - it's FREE!
            http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
          • Eric Leenman
            Hi I have a file which contains lines like below Line 18 | 200 040 200 200 200 051 200 1C2 200 2E2
            Message 5 of 16 , Aug 2, 2006
            • 0 Attachment
              Hi

              I have a file which contains lines like below

              Line 18 | 200 040 200
              200 200 051 200 1C2 200 2E2 Line 18 |
              200 040 200 040 200 052 200 1B9 200 2F4
              Line 18 | 200 040 200
              040 200 200 200 1C2 200 2DC
              Line 18 | 200 040 200
              040 200 063 200 1D6 200 2D4

              How do I deleted per line all the 'odd' 200?
              So that it becomes like:

              Line 18 | 040
              200 051 1C2 2E2 Line 18 |
              040 040 052
              1B9 2F4 Line 18 |
              040 040 200 1C2 2DC
              Line 18 | 040
              040 063 1D6 2D4

              Kind regards,
              Eric

              _________________________________________________________________
              On the road to retirement? Check out MSN Life Events for advice on how to
              get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
            • Charles E Campbell Jr
              ... This request requires a multi-step process: ... b) Next, you appear to want to sort the lines based on the text to the left of the | s (ie. Line 18,
              Message 6 of 16 , Aug 2, 2006
              • 0 Attachment
                Eric Leenman wrote:

                > Hi,
                >
                > I have a long file which contains like:
                > ##################################################
                > | 0 1 2 3 4 5 6
                > ##################################################
                > Line 18 | 123
                > Line 19 | abc
                > --------------------------------------------------
                > Line 332 | xyz
                > ##################################################
                > | 0 1 2 3 4 5 6
                > ##################################################
                > Line 18 | 641
                > Line 19 | GHI
                > --------------------------------------------------
                > Line 332 | vcx
                > ##################################################
                > | 0 1 2 3 4 5 6
                > ##################################################
                > ....
                >
                > How do I sort this file so that
                > - all line 18 , i.e., comes under each other? And line 19 , and so on.
                > - removes the lines starting with ###
                > - removes the lines starting with ---
                > - removes the lines starting with spaces
                >
                > So that what remains look like this:
                > ...
                > Line 18 | 123
                > Line 18 | 641
                > Line 19 | abc
                > Line 19 | GHI
                > Line 332 | xyz
                > Line 332 | vcx
                > ...

                This request requires a multi-step process:

                a) Delete the trash:
                :v/\<Line\>/d

                b) Next, you appear to want to sort the lines based on the text to the
                left of the "|"s
                (ie. Line 18, Line 332, etc). Because the remaining lines begin
                with "Line", you
                have several sorting options. You can just sort the lines using an
                external sort:

                :%!sort

                If you're using vim 7.0, you can use the built-in sort:

                :%sort

                Some more types of sorting are supported by my vissort plugin
                (http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
                see "Visual Block Sorting") which allows one to sort lines based on
                a visual-block,
                or you can use my vis.vim plugin (..., see "Visual Block Commands") and
                sort the visual block independently of surrounding text.

                Regards,
                Chip Campbell

                P.S. Replying to an email but changing the subject line as you did here
                can cause
                folks to miss your post, if said folks are not interested in
                the original subject
                but happen to be interested in your subject. With mozilla,
                for example, the
                entire tree of articles and responses get grouped under the
                original article.
              Your message has been successfully submitted and would be delivered to recipients shortly.