Nano on server ignores specific syntax coloring

I use nanoon the server via ssh; on this system, nanoby default, has no syntax color. Therefore, I copied these nanosyntax files (for an alternative, see also @CraigBarnes answer ) on the server and configured ~/.nanorcas:

include "~/nanosyntax/syntax-nanorc/php.nanorc"
include "~/nanosyntax/syntax-nanorc/php2.nanorc"
include "~/nanosyntax/syntax-nanorc/sh.nanorc"
include "~/nanosyntax/syntax-nanorc/python.nanorc"
include "~/nanosyntax/syntax-nanorc/html.nanorc"
include "~/nanosyntax/syntax-nanorc/perl.nanorc"
include "~/nanosyntax/syntax-nanorc/ruby.nanorc"
include "~/nanosyntax/syntax-nanorc/js.nanorc"

Now, this is the thing; if I just call:

nano somefile.php

... no phpSyntax coloring completed. If I try to force:

nano --syntax=php somefile.php

... still no syntax coloring (shown as plain text). However, if I do this:

nano ~/.nanorc

... then I do get the syntax coloring (matches the type file .nanorc) ?!

, , (.. nano ) - , , php?!

, - , - php?

,
!

+3
3

, , . , :

:

include "~/.nano/nanorc.nanorc"
include "~/.nano/sh.nanorc"
# more includes...

sh:

include "~/.nano/sh.nanorc"
include "~/.nano/nanorc.nanorc"
# more includes...

, , ( nano 2.2.2, nano 2.1.7)

+5

"" Google Code , , nano .

nano , - (, GtkSourceView), :

https://github.com/craigbarnes/nanorc

+1

Hm... , , , , ; nano , ~/.nanorc.

, , nano, -, php - ~/.nanorc, , ; , ~/.nanorc ( #), php !

!:)
!


EDIT: nano:

As noted above, syntax coloring is forcibly switched using a switch --syntax; to see which syntaxes are available:

grep 'include' /etc/nanorc |       # find lines containing 'include' in nanorc
  grep -v '^#' |                   # don't process lines that start with '#'
    sed 's_.*/\(.*\)\.nanorc"_\1_' # extract plain filenames

The result of this command:

nanorc
c
css
debian
gentoo
html
...

To enhance the syntax for nanoork, you use:

nano --syntax=nanorc /usr/share/nano/nanorc.nanorc

.. or force bash shell script syntax coloring (especially useful with bashrc):

nano --syntax=sh ~/.bashrc
0
source

Source: https://habr.com/ru/post/1786592/


All Articles