[notepad++] Convert tabs to spaces in Notepad++

How do I convert tabs to spaces in Notepad++?

I found a webpage that suggests it's possible, but I couldn't find any information about how to do it.

I would like to be able to do that, because some web forms don't respect code with tabs in them.

This question is related to notepad++ whitespace indentation

The answer is


The following way is the best way in my opinion:

Download:

  1. Notepad++
  2. The plugin http://sourceforge.net/projects/tabstospacesnpp/?source=typ
  3. Read the instructions and it will convert tabs to spaces.

If you happen to work in a Unix environment, the expand command is what you need:


You need to replace \t - make sure you use extended mode!

Replace


I just posted a Notepad++ plugin to convert tabs to spaces. Yes, it converts tabs in the middle of a line. Yes, it takes into account other characters within the tabbed field. Check it out.


Settings > Preferences > Tab Settings Check the "replace by space". Notice above it there is Tab size: 4 Click on the four and a window will open with the option to change the value to another integer.

Put in your desired integer and press the ENTER key.

There you have it <3.


You need to replace \t - make sure you use extended mode!

Replace


Obsolete: This answer is correct only for an older version of Notepad++. Converting between tabs/spaces is now built into Notepad++ and the TextFX plugin is no longer available in the Plugin Manager dialog.

  • First set the "replace by spaces" setting in Preferences -> Language Menu/Tab Settings.
  • Next, open the document you wish to replace tabs with.
  • Highlight all the text (CTRL+A).
  • Then select TextFX -> TextFX Edit -> Leading spaces to tabs or tabs to spaces.

Note: Make sure TextFX Characters plugin is installed (Plugins -> Plugin manager -> Show plugin manager, Installed tab). Otherwise, there will be no TextFX menu.


Settings -> Preference -> Edit Components (tab) -> Tab Setting (group) -> Replace by space

In version 5.6.8 (and above):

Settings -> Preferences... -> Language Menu/Tab Settings -> Tab Settings (group) -> Replace by space


Obsolete: This answer is correct only for an older version of Notepad++. Converting between tabs/spaces is now built into Notepad++ and the TextFX plugin is no longer available in the Plugin Manager dialog.

  • First set the "replace by spaces" setting in Preferences -> Language Menu/Tab Settings.
  • Next, open the document you wish to replace tabs with.
  • Highlight all the text (CTRL+A).
  • Then select TextFX -> TextFX Edit -> Leading spaces to tabs or tabs to spaces.

Note: Make sure TextFX Characters plugin is installed (Plugins -> Plugin manager -> Show plugin manager, Installed tab). Otherwise, there will be no TextFX menu.


CLR Tabs to Spaces plugin should be a good option. I have used it and it worked.


In version 5.8.7:

Menu Settings -> Preferences... -> Language Menu/Tab Settings -> Tab Settings (you may select the very language to replace tabs to spaces. It's cool!) -> Uncheck Use default value and check Replace by space.

Screenshot of the Preferences dialog


The easy way:

  1. Highlight a single tab area
  2. Copy
  3. Bring up find/replace
  4. Paste into the find field
  5. Click into the replace field and hit the space bar
  6. Then replace all.

There is no 'Edit Components' tab in the preferences setup. You need to go 'Language Menu/Tab Settings', there is an option in there to control tab behavior. You can even set it to work differently depending on the language of the file.


The easy way:

  1. Highlight a single tab area
  2. Copy
  3. Bring up find/replace
  4. Paste into the find field
  5. Click into the replace field and hit the space bar
  6. Then replace all.

Settings -> Preference -> Edit Components (tab) -> Tab Setting (group) -> Replace by space

In version 5.6.8 (and above):

Settings -> Preferences... -> Language Menu/Tab Settings -> Tab Settings (group) -> Replace by space


I follow this simple way:

  • Double click (Highlight) single tab (ie: \t).
  • Press ctrl + F (Find/repace).
  • You may not see \t or single tab area on Find What: field. But don't worry.
  • Enter a space in Replace With: field.
  • Click Replce All .

Done! :)

See:

Replace *Tab* by *Space* in <code>Notepad++</code>

Note: This method applies to reverse (Replace a space by a tab) case too.


Settings -> Preference -> Edit Components (tab) -> Tab Setting (group) -> Replace by space

In version 5.6.8 (and above):

Settings -> Preferences... -> Language Menu/Tab Settings -> Tab Settings (group) -> Replace by space


I just posted a Notepad++ plugin to convert tabs to spaces. Yes, it converts tabs in the middle of a line. Yes, it takes into account other characters within the tabbed field. Check it out.


CLR Tabs to Spaces plugin should be a good option. I have used it and it worked.


I did not read all of the answers, but I did not find the answer I was looking for.

I use Python and don't want to do find/replace or 'blank operations' each time I want to compile code...

So the best solution for me is that it happens on the fly!

Here is the simple solution I found:

Go to:

  1. Menu Settings -> Preferences
  2. Choose Tab Settings
  3. Choose your language type (e.g. Python)
  4. Select checkbox 'Use default value'
  5. Select checkbox 'Replace by space'

Enter image description here


You need to replace \t - make sure you use extended mode!

Replace


Settings -> Preference -> Edit Components (tab) -> Tab Setting (group) -> Replace by space

In version 5.6.8 (and above):

Settings -> Preferences... -> Language Menu/Tab Settings -> Tab Settings (group) -> Replace by space


The following way is the best way in my opinion:

Download:

  1. Notepad++
  2. The plugin http://sourceforge.net/projects/tabstospacesnpp/?source=typ
  3. Read the instructions and it will convert tabs to spaces.

Follow this procedure to convert spaces to tabs or vice-versa:

Space - Tab


Obsolete: This answer is correct only for an older version of Notepad++. Converting between tabs/spaces is now built into Notepad++ and the TextFX plugin is no longer available in the Plugin Manager dialog.

  • First set the "replace by spaces" setting in Preferences -> Language Menu/Tab Settings.
  • Next, open the document you wish to replace tabs with.
  • Highlight all the text (CTRL+A).
  • Then select TextFX -> TextFX Edit -> Leading spaces to tabs or tabs to spaces.

Note: Make sure TextFX Characters plugin is installed (Plugins -> Plugin manager -> Show plugin manager, Installed tab). Otherwise, there will be no TextFX menu.


I follow this simple way:

  • Double click (Highlight) single tab (ie: \t).
  • Press ctrl + F (Find/repace).
  • You may not see \t or single tab area on Find What: field. But don't worry.
  • Enter a space in Replace With: field.
  • Click Replce All .

Done! :)

See:

Replace *Tab* by *Space* in <code>Notepad++</code>

Note: This method applies to reverse (Replace a space by a tab) case too.


Follow this procedure to convert spaces to tabs or vice-versa:

Space - Tab


I did not read all of the answers, but I did not find the answer I was looking for.

I use Python and don't want to do find/replace or 'blank operations' each time I want to compile code...

So the best solution for me is that it happens on the fly!

Here is the simple solution I found:

Go to:

  1. Menu Settings -> Preferences
  2. Choose Tab Settings
  3. Choose your language type (e.g. Python)
  4. Select checkbox 'Use default value'
  5. Select checkbox 'Replace by space'

Enter image description here


In version 5.8.7:

Menu Settings -> Preferences... -> Language Menu/Tab Settings -> Tab Settings (you may select the very language to replace tabs to spaces. It's cool!) -> Uncheck Use default value and check Replace by space.

Screenshot of the Preferences dialog


There is no 'Edit Components' tab in the preferences setup. You need to go 'Language Menu/Tab Settings', there is an option in there to control tab behavior. You can even set it to work differently depending on the language of the file.


If you happen to work in a Unix environment, the expand command is what you need:


Settings > Preferences > Tab Settings Check the "replace by space". Notice above it there is Tab size: 4 Click on the four and a window will open with the option to change the value to another integer.

Put in your desired integer and press the ENTER key.

There you have it <3.


You need to replace \t - make sure you use extended mode!

Replace


Examples related to notepad++

How to view Plugin Manager in Notepad++ How to format JSON in notepad++ CR LF notepad++ removal How to install a Notepad++ plugin offline? Find duplicates and delete all in notepad++ How to compare two files in Notepad++ v6.6.8 Notepad++ cached files location How to indent HTML tags in Notepad++ How to change background color in the Notepad++ text editor? How do I stop Notepad++ from showing autocomplete for all words in the file

Examples related to whitespace

How to create string with multiple spaces in JavaScript git: fatal: I don't handle protocol '??http' Show whitespace characters in Visual Studio Code What is the symbol for whitespace in C? How to print variables without spaces between values Trim whitespace from a String How do I escape spaces in path for scp copy in Linux? Avoid line break between html elements Remove "whitespace" between div element How to remove all white spaces in java

Examples related to indentation

How to indent/format a selection of code in Visual Studio Code with Ctrl + Shift + F Python IndentationError unindent does not match any outer indentation level How to change indentation mode in Atom? How to set HTML Auto Indent format on Sublime Text 3? "Expected an indented block" error? Indent starting from the second line of a paragraph with CSS Indentation Error in Python How to fix/convert space indentation in Sublime Text? How to make the tab character 4 spaces instead of 8 spaces in nano? IndentationError: unexpected unindent WHY?