服务器上的Nano忽略某些语法颜色 [英] Nano on server ignores certain syntax coloring

查看:159
本文介绍了服务器上的Nano忽略某些语法颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过ssh在服务器上使用nano;在该系统上,默认情况下nano没有启用语法颜色.因此,我复制了这些 nanosyntax 文件(作为替代,另请参见@CraigBarnes的答案 ),并且已将~/.nanorc设置为:

I'm using nano on a server via ssh; on that system, nano doesn't have syntax color enabled by default. So I copied these nanosyntax files (for alternative, see also @CraigBarnes' answer) on the server, and had set up ~/.nanorc as:

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

...没有完成php语法着色.如果我尝试强制:

... no php syntax coloring is done. If I try to force:

nano --syntax=php somefile.php

...仍然没有语法着色(显示为纯文本).但是,如果我这样做:

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

nano ~/.nanorc

...然后我进行语法着色(对应于.nanorc类型的文件)?!

... then I do get syntax coloring (that corresponds to .nanorc type file) ?!

很明显,语法着色就可以这样工作(即shell和nano都可以)-除非,某些语言似乎忽略了这种着色,例如php?!

So obviously, syntax coloring as such works (i.e. shell and nano are capable of it) - except, it seems to be ignored for some languages, like in this case php ?!

那么,有谁知道这是怎么回事-如何为php文件提供语法着色?

So, does anyone know what is going on - and how could I get syntax coloring also for php files?

谢谢,
干杯!

Thanks,
Cheers!

推荐答案

我只是遇到了同样的问题,我在包含内容中摆弄了些什么来查找错误.令人惊讶的是,事实证明,更改包含顺序可以解决该问题:

I just ran into the same problem, and I fiddled around a bit with the includes to find the error. Surprisingly, turns out that changing the inclusion order fixed the issue:

这有效:

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

这不能突出显示sh文件:

This fails to highlight sh files:

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

所以我想这可能是一个错误(在nano 2.2.2中;在nano 2.1.7中工作得很好)

So I guess it's probably a bug (in nano 2.2.2; worked fine in nano 2.1.7)

这篇关于服务器上的Nano忽略某些语法颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆