Ubuntu – How to get spaces instead of tabs in nano

command linenano

I usually edit Python files with nano, so I need four spaces instead of a tab. How can I get nano to automatically insert spaces for tabs, and control how many of them it inserts?

Best Answer

Either create .nanorc in your home folder, including:

set tabsize 4
set tabstospaces

or edit the system /etc/nanorc file.