I have placed
https://github.com/serialhex/nano-highlight/blob/master/delphi.nanorc to my /usr/share/nano folder, hoping that my Pascal source code would then be syntax-highlighted by Nano. But, Nano has never able to do so. Have I missed something?
P.S.: No error code is generated when I open a .pas file. I use fpc as compiler.
Create a file in your home
Then copy put your syntax file in ~/.config/nano
NOTE: Manually copying files to system folders has the possibility to create file conflicts for pacman at a later time.
man nanorc look for
When trying to find something in the man pages, try, in this case,
man -k nano.
- /etc/nanorc found via
I currently put my nano usr configuration file in
A syntax file can be inline or included.
The snippet below is part of my nanorc file with an inline highlighting file. I could have easily done
include './asciidoc.nanorc' if I had put it in the directory $HOME/.config/nano/
### Simple asciidoc highlighting
syntax "AsciiDoc" "\.(txt|asc)$"
color black,white "^=[[:space:]]+.+[[:space:]]+=$"
color red "^==[[:space:]]+.+[[:space:]]+==$"
color red "^===[[:space:]]+.+[[:space:]]+===$"
color blue "^\.[^[:space:].]+.+$"
Thank you for your quick reply. I forgot to mention that I have already set
include /usr/share/nano/*.nanorc in my nano configuration file. It works straight away for other “built-in” syntaxes like c, fortran and python. At some point, I then realized that actually the original file delphi.nanorc was insufficiently configured. By, adding some proper pascal syntax highlighting rules to the original delphi.nanorc, it is now working properly as I intended.
I must say big thank you. Looking at your sample asciidoc.nanorc, I finally figured out what was wrong with my delphi.nanorc file.
It lacked proper syntax, such as
color brightmagenta "\<(and|div|mod|or)\>". Those kind of syntax is what I need for syntax-highlighting my pascal code. Sorry for my slow respones.