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

column alignment ?

Expand Messages
  • stosss
    I start out with this: text text more text more text still more text still more text I want to end up with this: text text more text
    Message 1 of 4 , Jan 7 9:00 AM
      I start out with this:

      text text
      more text more text
      still more text still more text

      I want to end up with this:

      text text
      more text more text
      still more text still more text

      I have no idea what help to look for or if this is even possible
      except for doing it manually. Is there a way to use a specific column
      on each line to accomplish this with maybe a s/search/replace/ ?

      --
      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
    • Chris Schneider
      There are plugins to help: Tabularize is the one I use. So assuming the larger spaces were t characters (actual tabs), it d be :Tabularize / t If they are
      Message 2 of 4 , Jan 7 9:19 AM
        There are plugins to help: Tabularize is the one I use.  So assuming the larger spaces were \t characters (actual tabs), it'd be :Tabularize /\t

        If they are really spaces, you can get clever with a search/replace before calling the plugin. Something like  s/\s+/ - / (replace multiple spaces with a dash). Then :Tabularize /- to organize on that dash. Then you can use column edit mode (ctrl-v) to delete the dash you no longer need.

        I'm sure you can do it in other more clever ways, but that's how I'd get it done.



        On Mon, Jan 7, 2013 at 10:00 AM, stosss <stosss@...> wrote:
        I start out with this:

        text    text
        more text    more text
        still more text    still more text

        I want to end up with this:

        text                   text
        more text          more text
        still more text    still more text

        I have no idea what help to look for or if this is even possible
        except for doing it manually. Is there a way to use a specific column
        on each line to accomplish this with maybe a s/search/replace/ ?

        --
        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 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
      • Charles Campbell
        ... What separates the two sets of text? If its a tab, and using the Align plugin (http://www.drchip.org/astronaut/vim/index.html#ALIGN): use V+motion to
        Message 3 of 4 , Jan 7 1:51 PM
          stosss wrote:
          > I start out with this:
          >
          > text text
          > more text more text
          > still more text still more text
          >
          > I want to end up with this:
          >
          > text text
          > more text more text
          > still more text still more text
          >
          > I have no idea what help to look for or if this is even possible
          > except for doing it manually. Is there a way to use a specific column
          > on each line to accomplish this with maybe a s/search/replace/ ?
          >
          What separates the two sets of text?

          If its a tab, and using the Align plugin
          (http://www.drchip.org/astronaut/vim/index.html#ALIGN):

          use V+motion to select lines
          \tab

          Regards,
          Chip Campbell

          --
          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
        • Gary Johnson
          ... And if it s not a tab but is just a sequence of two or more spaces, you could convert those sequences to tabs as part of Chip s solution: use V+motion to
          Message 4 of 4 , Jan 7 2:58 PM
            On 2013-01-07, Charles Campbell wrote:
            > stosss wrote:
            > >I start out with this:
            > >
            > >text text
            > >more text more text
            > >still more text still more text
            > >
            > >I want to end up with this:
            > >
            > >text text
            > >more text more text
            > >still more text still more text
            > >
            > >I have no idea what help to look for or if this is even possible
            > >except for doing it manually. Is there a way to use a specific column
            > >on each line to accomplish this with maybe a s/search/replace/ ?
            > >
            > What separates the two sets of text?
            >
            > If its a tab, and using the Align plugin
            > (http://www.drchip.org/astronaut/vim/index.html#ALIGN):
            >
            > use V+motion to select lines
            > \tab

            And if it's not a tab but is just a sequence of two or more spaces,
            you could convert those sequences to tabs as part of Chip's
            solution:

            use V+motion to select lines
            :s/ \{2,}/\t/
            gv
            \tab

            The gv re-selects the lines.

            Regards,
            Gary

            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.