Tapatalk

reformatting a file for proper indentation?

reformatting a file for proper indentation?

601
Advanced UserAdvanced User
601

    Feb 15, 2006#1

    Is there a way to reformat a file you've already typed (but didn't save yet) so that once it is saved with the proper extension, it will have the proper tab settings for that extension?

    Example: My default settings are 4 spaces, but for HTML I do 2. If I write an HTML file and *then* save it as file.html, can I somehow reformat the indents to change to 2 spaces instead of the 4?

    Thanks.

    6,685587
    Grand MasterGrand Master
    6,685587

      Feb 15, 2006#2

      This little macro will do this for files with the extension html or htm.

      InsertMode
      ColumnModeOff
      HexOff
      IfExtIs "html"
      Top
      Find " "
      Replace All "^t"
      Find "^t"
      Replace All " "
      Else
      IfExtIs "htm"
      Top
      Find " "
      Replace All "^t"
      Find "^t"
      Replace All " "
      EndIf
      EndIf

      And don't forget to enable the macro property Continue if a Find with Replace not found. I think, I must not explain this simple macro.
      Best regards from an UC/UE/UES for Windows user from Austria

      601
      Advanced UserAdvanced User
      601

        Feb 15, 2006#3

        Ah, macros again! Thanks! :)