Debian 的 Nano 语法高亮

Debian 的 Nano 语法高亮

我正在运行 Debian,我想为 启用语法高亮nano。我的系统有预定义的语法定义...

standage@idebian:~$ ls /usr/share/nano/
asm.nanorc    c.nanorc       fortran.nanorc  html.nanorc      man.nanorc     nanorc.nanorc  patch.nanorc  pov.nanorc     sh.nanorc   xml.nanorc
awk.nanorc    css.nanorc     gentoo.nanorc   java.nanorc      mutt.nanorc    objc.nanorc    perl.nanorc   python.nanorc  tcl.nanorc
cmake.nanorc  debian.nanorc  groff.nanorc    makefile.nanorc  nano-menu.xpm  ocaml.nanorc   php.nanorc    ruby.nanorc    tex.nanorc

...我已经将所有这些都包含在我的~/.nanorc文件中。

standage@idebian:~$ head /home/standage/.nanorc 
include "/usr/share/nano/asm.nanorc"
include "/usr/share/nano/awk.nanorc"
include "/usr/share/nano/cmake.nanorc"
include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/css.nanorc"
include "/usr/share/nano/debian.nanorc"
include "/usr/share/nano/fortran.nanorc"
include "/usr/share/nano/gentoo.nanorc"
include "/usr/share/nano/groff.nanorc"
include "/usr/share/nano/html.nanorc"

但是,当我打开具有典型文件扩展名(.c、.h 等)的代码文件时,没有语法高亮显示。奇怪的是,当我打开文件.nanorc进行检查时,语法高亮显示被激活了。

难道我做错了什么?

答案1

我猜你的〜/.nanorc(语法、行尾或其他内容),因为您获得了正确的 ****.nanorc*** 高亮显示,默认情况下,它在全局上是启用的/etc/nanorc

尝试只添加一个包含(例如include "/usr/share/nano/c.nanorc")到/etc/nanorc看看会发生什么。

编辑:嗯,这很奇怪,但包含的顺序似乎也很重要...乍一看,当 ****.nanorc*** 文件按字母顺序包含时,一切都正常。

答案2

删除这样的引号(在 Debian 上测试过):

include /usr/share/nano/sh.nanorc

来源:https://askubuntu.com/questions/90013/how-do-i-enable-syntax-highlighting-in-nano#90026

相关内容