Most Users Want to Enable Syntax Highlighting in nano on SSH from iTerm2. It really looks odd to have mono colored SSH screen. Definitely you know what is Syntax Highlighting, else you would not search or read this article! The basic thing need to be understood is that; definitely your Terminal or iTerm2 is well decorated with Color Schemes, Syntax Highlighting etc; keep two things in mind – first for iTerm2 we usually setup ZSH as Shell – we are talking about Unix Shell. You can read a bit unrelated article – Syntax Highlighting in Vim inside iTerm2. So the first point is; our local shell’s setup loaded on iTerm2 will reflect when we are working with nano on different server (this is not fully right correct though) – situation is exactly like the Mac users who can not find their .profile file. Secondly, we are using GNU nano not vi (that is vim text editor).
Obviously, some components defined for iTerm2 setup will help you to see things with colors. Like folders, symlinked folders etc.
Enable Syntax Highlighting in nano on SSH from iTerm2
On Debian or Ubuntu, if you open sources.list life (we are talking about SSH session, you are already on your server) :
Honestly, this colorful thing, exactly like we love to see appears even on PuTTY made me to think and find the reasons and do the right steps to get somewhat nice Syntax Highlighting in nano on SSH. So, first I went to Nano’s official web page :
I discovered this repository :
Unfortunately, that was not great. Nano itself possibly do not have good Syntax Highlighting support. I had some colors though on the session as a whole :
I exited from SSH session, ran :
In case when you don™t have your local copy of say .profile then the system uses /etc/profile. /etc/profile and ~/.profile is read for an interactive login shell, and ~/.bashrc is read for an interactive non-login shell. Obviously, the server need to be tweaked a bit (from the docs). If you want to force zsh, open zshrc and add these :
nano --syntax=sh ~/.zshrc
Basically, most of us have a file :
That is basically why we use “themes” for an overall easy setup.
It creates issues with an interactive login shell. Once you understand the regex patterns to define things of your choice; actually you can do many colorful things.
Follow the Author of this article :