julia-vim中的Julia语法高亮 [英] Julia syntax highlighting in julia-vim

查看:194
本文介绍了julia-vim中的Julia语法高亮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将gvim与julia-vim一起使用来编辑julia代码.我在Mac上使用julia 0.5,并使用vundle安装了julia-vim.

I use gvim with julia-vim for editing julia code. I am using julia 0.5 on a mac and installed julia-vim with vundle.

我的问题是扩展名为.jl的文件没有适当的突出显示.例如,突出显示if,但未突出显示for.有什么解决办法吗?

My problem is that files with the .jl extension do not have appropriate highlighting. For example, if is highlighted but for is not. Any solution for this?

推荐答案

.jl文件有时默认情况下被识别为lisp文件,(怪怪

.jl files are sometimes recognized as lisp files by default, (blame Sawfish) so that's probably the syntax highlighting you're getting. (type defun and progn and etc and see if the pretty colors pop up)

当您说正确的解决方案是:set syntax=julia时,您已经很接近了,您需要设置filetype加上一些autocmd魔术,以使每次打开.jl文件时都可以实现.

You were close when you said the correct solution was :set syntax=julia, what you need is to set filetype plus some autocmd magicks to make that happen every time you open a .jl file.

在您的 目录:

autocmd BufRead,BufNewFile *.jl :set filetype=julia

那应该做到的.


附录1 :根据问题的根源,可能需要更改filetype而不是syntax来触发诸如LaTeX扩展之类的其他功能,这就是我所使用的.

Addendum 1: Changing filetype instead of syntax may be required to trigger additional features like the LaTeX expansions depending on the root of your problem, so that's what I am using.

附录2 :请注意,此问题应由julia-vim插件处理,但与其他脚本冲突可能会使其混乱.您可以使用:scriptnames查看已加载的脚本和加载顺序,并尝试调试可能导致冲突的内容(如果您认为值得这样做的话).

Addendum 2: Note that this should've been handled by the julia-vim plugin, but conflicts with other scripts can mess with that. You can use :scriptnames to see what scripts have been loaded and in what order, and try to debug what could be causing the conflict, if you think that's worth the trouble.

附录3 :还涉及到Vundle在文件类型方面需要进行一些特定的配置,因此也可能导致这种情况.但是,由于多种原因,我已经看到这种情况,并且在Vundle之外也发生了类似的问题,因此我仍然认为,顶部的解决方案是最好的解决方案,并且可能会避免将来出现一些麻烦.

Addendum 3: Also related is that Vundle has some specific configurations that need to be made when it comes to filetypes, so that could also be causing this. However, I've seen this and similar problems happen outside Vundle for any number of reasons so I still believe that the solution at the top is the best one, and will possibly prevent some future headaches.

这篇关于julia-vim中的Julia语法高亮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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