Is there a way to enable colored syntax highlighting in the nano text editor? When I open for example the .bashrc file or any other file written in C, Java, etc. the whole content of the file is plain white. However when opening those files in vim, everything is highlighted correctly. I also remember using nano in other distros and not having this problem. It would be great if someone could tell me how to add it!
Can you share the contents of your
Do you even have a
If not, make a
~/.nanorc file (using nano, for example) that contains this:
Ok, gotcha, I misunderstood what you wrote first
Fantastic, now it’s working! Thanks
You might also take a look at micro - it also edits in the terminal, but does LOTS more and uses more familiar shortcuts…
Add something like this to your
bind F1 help main bind F2 curpos main bind ^c copy main bind ^x cut main bind ^v paste main bind ^z undo main bind ^y redo main bind ^f whereis main bind F3 findnext main bind ^h replace main bind ^s writeout main bind ^q exit main
There, “familiar” shortcuts in nano.
RTFM for more nice things you can put in your
Didn’t know you could get them all in there - I wonder if we should add that version of the file to our ISO? - or maybe a button to ‘activate’ it on demand…
Probably not, since people who use nano tend to be used to default keybindings. Also, most guides online are made with default keybindings in mind. Changing it might cause more confusion than benefit…
In any case, nano is a fairly configurable editor, you can change its behaviour significantly with a good
.nanorc, but it might be better for every user to write his or her own config.
Thanks for the suggestion! I mainly use Vim and try to learn its useful features but when I want to quickly edit a file I use nano. I will also take a look at micro and see how I like it.
Use vim. Nano isn’t much quicker in most cases.
More nano help from here:
(post deleted by the author)
yay -S nano-syntax-highliting might also have solved the issue.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.