简体   繁体   English

在鼠尾草上使用合成的(或任何vim检查器)

[英]use syntastic (or any vim checker) on a sagemath

I'm using vim for .sage files and I try to have a checker for these files. 我正在对.sage文件使用vim,并且尝试对这些文件使用检查器。 syntastic can handle python verification (with flake8 ) so I wanted to try this. syntastic可以处理python验证(使用flake8 ),所以我想尝试一下。

The first idea I had is to put something like this in my .vim/filetype.vim : 我的第一个想法是在.vim / filetype.vim中放入如下内容:

au BufNewFile,BufRead *.sage    setfiletype sage

But, I have some "useful" things in my .vim/ftplugin/sage.vim so I don't want to assimilate .sage files and .vim files. 但是,我的.vim / ftplugin / sage.vim中有一些“有用”的东西,所以我不想吸收.sage文件和.vim文件。

So, my question is: is it possible for example to just tell syntastic to treat .sage files as a .py file? 因此,我的问题是:例如,是否可以仅告诉syntastic将.sage文件视为.py文件?

The other problem I may have is that flake8 won't be happy with the sagemath functions that don't exist in python. 我可能遇到的另一个问题是flake8对python中不存在的sagemath函数不满意。 Is there something I can do with that? 有什么我可以做的吗?

Thanks for your help. 谢谢你的帮助。

In fact, I was, I hope, just to tired to understand well enough the faq of syntastic.. 我希望,事实上,我只是累了才能充分理解语法的常见问题。

I put 我放

let g:syntastic_sage_checkers = ['python/flake8']
et g:syntastic_sage_flake8_args = '--ignore=F821

in my .vimrc 在我的.vimrc中

the first line, as explained in the syntastic page, tells that "even if the type is sage, I will use flake8, usually used for python files. 第一行,如合成页面中所述,告诉我们:“即使类型为鼠尾草,我也会使用flake8,通常用于python文件。

the second disable the error F821 of flake8 , it is the error for "undefined name". 第二禁用flake8的错误F821,它是“未定义名称”错误 It is usefull because of the sagemath functions that differs from python.. 这是有用的,因为Sagemath函数不同于python。

` `

autocmd BufNewFile,BufRead *.sage set filetype=sage

应该在~/.vim/ftdetect/sage.vim

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM