Nano 中对 Julia 的语法高亮支持

Syntax highlighting support for Julia in Nano

我经常使用最小的 Nano 文本编辑器。最近,我开始尝试使用年轻的 Julia 编程语言,但发现 .ji 扩展名不会像 Python.

这样的公认语言那样在编辑器环境中触发适当的突出显示。

Julia x Nano 是否支持语法高亮显示?如果没有,我怎么能为 Nano 添加对新语言的语法高亮支持呢?每种语言都有标准模板吗?

引用 Matt B. 的评论,查看 Google 的 nano julia syntax is this reddit thread 的最高结果。

只需将其复制并粘贴到您的 .nanorc(通常位于 ~/.nanorc):

syntax "julia" "\.jl$"

color brightblack  "\<(begin|break|catch|continue|function|elseif|else|end)\>"
color brightblack  "\<(finally|for|global|local|if|include|using|require|macro)\>"
color brightblack  "\<(println|return|try|type|while|module)\>"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
color white    "[(]"
color red "[-+*/|=%<>&~^]|\<(and|not|or|is|in)\>"
color brightyellow    "@[A-Za-z0-9_]+"
color brightmagenta  "__[A-Za-z0-9_]+__"
color brightcyan  "\<(true|false)\>"
color yellow ""(\.|[^"])*"|'(\.|[^'])*'"
color yellow   "['][^']*[^\][']" "[']{3}.*[^\][']{3}"
color yellow   "["][^"]*[^\]["]" "["]{3}.*[^\]["]{3}"
color yellow   start=""""[^"]" end="""""
color yellow   start="'''[^']" end="'''"
color magenta   "\.?"
color cyan "(^|[[:space:]])#([^{].*)?$"
color brightwhite,cyan "TODO:?"

有关更新版本,请参阅 https://github.com/Naereen/nanorc/blob/master/julia.nanorc