语法突出显示对Nano中Julia的支持

时间:2016-02-03 21:48:32

标签: julia nano

我经常使用最小的Nano文本编辑器。最近,我开始尝试使用年轻的Julia编程语言,但发现.ji扩展不会在编辑器环境中触发适当的突出显示,就像对Python这样的公认语言一样。

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

1 个答案:

答案 0 :(得分:4)

引用马特B.的评论,请参阅Google nano julia syntax的最高结果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