Convert tabs to spaces in Notepad++

2019-01-01 16:17发布

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.

15条回答
情到深处是孤独
2楼-- · 2019-01-01 16:50

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.

查看更多
流年柔荑漫光年
3楼-- · 2019-01-01 16:51

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.

查看更多
只靠听说
4楼-- · 2019-01-01 16:54

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

查看更多
刘海飞了
5楼-- · 2019-01-01 16:55

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

Space - Tab

查看更多
几人难应
6楼-- · 2019-01-01 17:03

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.

查看更多
美炸的是我
7楼-- · 2019-01-01 17:06

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

查看更多
登录 后发表回答