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 17:08

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

查看更多
何处买醉
3楼-- · 2019-01-01 17:12

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

查看更多
后来的你喜欢了谁
4楼-- · 2019-01-01 17:13

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.

查看更多
墨雨无痕
5楼-- · 2019-01-01 17:14

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

Replace

查看更多
妖精总统
6楼-- · 2019-01-01 17:14

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.
查看更多
骚的不知所云
7楼-- · 2019-01-01 17:15

To convert existing tabs to spaces, press Edit->Blank Operations->TAB to Space.

If in the future you want to enter spaces instead of tab when you press tab key:

  1. Go to Settings->Preferences...->Language (since version 7.1) or Settings->Preferences...->Tab Settings (previous versions)
  2. Check Replace by space
  3. (Optional) You can set the number of spaces to use in place of a Tab by changing the Tab size field.

Screenshot of Replace by space

查看更多
登录 后发表回答