Background: To enable Nano's syntax highlighting I have configured various shared .nanorc
files with the format /usr/share/nano/*.nanorc
, eg /usr/share/nano/python.nanorc
This works well but I keep running into issues with Python where I would like it to convert tabs to spaces.
That setting is available (How do I get spaces instead of tabs in nano?) with set tabstospaces
, but it seems it has to be global.
Q. Is there a way to have this setting apply only on Python files?
I tried to move set tabstospaces
to the relevant nanorc
file, python.nanorc
mentioned above. However when I try this I get an error upon saving the file in Nano indicating that I can't do this because included files cannot contain set:
Error in /usr/share/nano/python.nanorc on line 42: Command "set" not allowed in included file
Perhaps this is simply a nano limitation and I have to set it only at the global level, but it would be ideal if it could be per syntax. It's not the biggest disaster as Nano is not my main text editor for code but it often convenient for something small.