简体   繁体   中英

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. syntastic can handle python verification (with flake8 ) so I wanted to try this.

The first idea I had is to put something like this in my .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.

So, my question is: is it possible for example to just tell syntastic to treat .sage files as a .py file?

The other problem I may have is that flake8 won't be happy with the sagemath functions that don't exist in python. 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

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.

the second disable the error F821 of flake8 , it is the error for "undefined name". It is usefull because of the sagemath functions that differs from python..

`

autocmd BufNewFile,BufRead *.sage set filetype=sage

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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