Nano 中,将默认的 [TAB] -> 换为 [TAB] -> ' '*4

If you use nano with a language like python (as in your example) it’s also a good idea to convert tabs to spaces.

Edit your ~/.nanorc file (or create it) and add:

set tabsize 4
set tabstospaces

If you already got a file with tabs and want to convert them to spaces i recommend the expandcommand (shell):

expand -4 >

From: How to make the tab character 4 spaces instead of 8 spaces in [email protected] Rojek