SourceForge has been redesigned. Learn more.
Close

Another "Replace Tabs by Space"

Frank
2008-10-30
2012-11-13
  • Frank

    Frank - 2008-10-30

    Hi there,

    i am quite sure I once found it in Notepad++, but I am no longer able to. I have Sourcecode with tabs at the very left, and tabs somewhere within the line. The Tabs within the line now should be replaced by spaces (so 2 tabs can either be 8 or only 5 spaces - replace wont work).

    If I cant leave the tab at the very left, I can live with all tabs being replaced.

    P.S.: does anybody know a good code-beautifier (c++)? Preferred if hightly configurable.

    Thanks in advance
    Frank

     
    • Airdrik

      Airdrik - 2008-11-05

      So you are saying you have something like:
      a\tb
      ab\tc
      abc\td

      where \t is a tab

      and you want the 1st \t replaced by 4 spaces, the second by 3 spaces and the third by 2 spaces?
      This is more complicated than a simple replace will do since it requires keeping track of the column position of each tab that is being replaced.
      I think that the TextFX plugin provided "replace tabs with space", but I think it was only on leading tabs (which I believe is what most editors will do, I may be wrong), and that plugin hasn't been updated to be Unicode compatible, so it doesn't work with NP++ 5.1 Unicode. 

       
      • Frank

        Frank - 2008-11-06

        Yes airdrik, this is exactly what I wanted. And now I know, why I was so sure notepad++ offered that (without ever having used it, just saw it in options). So if there is no solution, I can change the several thousand occurances whenever I meet them. I just hate doing manual work when there is a reasonable way to do it.

         
      • Frank

        Frank - 2008-11-06

        Thx for the pointer with the column position. Should be solveable with a few c++ lines.

         
    • qingping wang

      qingping wang - 2008-11-03

      As far as i am concerned the replace character in notepad++, I found the version 5.0.3 had the replace option with the special character such as \t \n and so on; if you are good at the C/C++ language you should known what do those character mean.

      Press the CTRL+H, then fill the target with
      \t

      replace
          (four spaces you do not see in here)

      try it,Good Luck

       
      • Frank

        Frank - 2008-11-05

        "The Tabs within the line now should be replaced by spaces (so 2 tabs can either be 8 or only 5 spaces - replace wont work). "

        Still thanks for the answer (if above is unclear: tab can be 1, 2, 3 or 4 spaces "wide").