Tabs to Spaces Expansion

  • M.Y.

    M.Y. - 2009-05-29


    Would appreciate if someone could enlighten me on the following:

    1. How to expand all the TAB chars in the <current document> (not global) into SPACES (and vice-versa)?

    2. How to set the number of spaces for each TAB char in the <current document> (not global)?


    • M.Y.

      M.Y. - 2009-05-30

      Thanks for the comments. What I would like to see is some kind of user-configurable Tab size setting based on file type (e.g., 2 for C/C++ files, 4 for Perl, etc). It should also have an option to replace all the Tab chars by spaces when the file is saved.

      The current global Tab size setting is nice but not good enough especially if we would like to use different Tab sizes for different file types.

    • Bill Wire

      Bill Wire - 2009-05-29

      The TextFX plugin has some functionality to convert/uncovert LEADNING spaces which I've never gotten to work.

      The problem with converting/unconverting non-leading spaces really manifests itself when you have string literals in the code.  What gets altered, and what does not?

      If you should come up with a way to do what you ask, I'm also very interested in it.  Especially if it can be restricted to just the selection I have active, or if it were an option to tell it what the start/end quote characters for the language are, and whether or not it should ignore string literals.

      I do not however believe what you are asking for is an option in N++.  Certainly not the document-level setting of the tab definitions.  After all, how would N++ remember the tab setting for your document the next time you load it?  It couldn't attach meta-data to the document.  That leaves either global settings, or entries in the session file (if you enable session-saving.)


    • Anonymous

      Anonymous - 2009-05-29

      For #1, you can highlight a TAB character and use Replace (Ctrl-H) to Replace All with a set number of spaces.