scopatz / nanorc

Improved Nano Syntax Highlighting Files
Other
3k stars 549 forks source link

MacOs - Running nano as sudo is not using syntax highlighting #321

Closed jacobkaufman closed 3 years ago

jacobkaufman commented 3 years ago

When I run nano as sudo nano it just runs the default nano setup, but when I run the command as my username then it works fine. I've looked all over for another .nanorc file that it might be pulling from and cant find any other then the one in /etc which I have already added the highlighting to. I'm wondering if this is maybe because sudo overwriting my environment variables but I'm still new to all of that. Any guidance would be great. Thank you!

scopatz commented 3 years ago

You probably need to have /root/.nanorc

jacobkaufman commented 3 years ago

I tried to create a root folder but on MacOS the root directory is read-only. I finally figured it out. For some reason running sudo disables all user config so to enable it I have to run sudo nano --rcfile=/etc/nanorc $file_name and it works! I think I'm just gonna make and alias for this and call it a day. Thank you for your help and your work!