Community
    • Login

    Columns++, I'd like to *retain* commas when converting to elastic tabs/spaces

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    5 Posts 2 Posters 51 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W PongW
      W Pong
      last edited by

      Greetings –

      I’m doing work in matlab where I frequently clean up legacy scripts involving array definitions. Syntax is

      myArray = {
      a,bbb,c,ddddd;
      e,ff,ggg,h;
      iiii,jj,k,l
      }
      In-house convention is to align the comma-separated array-elements into columns with spaces, while retaining the commas, as required by matlab syntax. Array element names can vary in length greatly, and files can get visually messy over time as different users edit and don’t re-align columns.

      What I typically do:

      (comma separated) --> convert separated values to tabs --> (elastic tabstops) --> convert tabs to spaces

      This is wonderfully quick and easy, but it removes the commas. I’ve played around but haven’t discovered – Is there a way to retain the commas?

      W PongW CoisesC 2 Replies Last reply Reply Quote 1
      • W PongW
        W Pong @W Pong
        last edited by

        I should add that my current workaround is to highlight the affected region and do an ‘extended’ find replace, replacing “\t” with “,\t”. This works fine. Was just hoping I could avoid this need…

        CoisesC 1 Reply Last reply Reply Quote 2
        • CoisesC
          Coises @W Pong
          last edited by

          @W-Pong said in Columns++, I'd like to *retain* commas when converting to elastic tabs/spaces:

          I should add that my current workaround is to highlight the affected region and do an ‘extended’ find replace, replacing “\t” with “,\t”. This works fine. Was just hoping I could avoid this need…

          If you never have commas within quoted strings in your arrays, just use a slightly modified version of your work-around: without doing any conversion first, replace , with ,\t.

          If you do sometimes have commas in quoted strings, you can either do what you’re doing now or devise a regular expression replacement that will skip commas within quoted strings.

          W PongW 1 Reply Last reply Reply Quote 2
          • W PongW
            W Pong @Coises
            last edited by

            @Coises Thanks much.

            1 Reply Last reply Reply Quote 0
            • CoisesC
              Coises @W Pong
              last edited by

              @W-Pong said in Columns++, I'd like to *retain* commas when converting to elastic tabs/spaces:

              Is there a way to retain the commas?

              I made a new release of Columns++ with an option to do that — an additional checkbox in the Conversion settings dialog: Keep separator character when converting to tabbed.

              The new release is Columns++ version 1.3.2.

              I have not marked the release stable, but I believe that there is very little chance this change will have any unanticipated negative effects. It should be safe to install.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors