It's not really a hack. The syntax and functions in Sage are a superset of 
what is there in python. So, it makes sense to set it to python. Of course, 
it would be nice to have Sage functions properly highlighted, but as a 
first step the commands below work. You don't get syntax highlighting for 
Sage functions, but you do get stuff properly indented.

On Thursday, August 23, 2012 3:16:20 PM UTC+8, Ruslan Kiyanchuk wrote:
>
> Vim filetypes To get Vim to use Python syntax highlighting,
>>> indentation, and so on for .sage files, put the following in
>>> $VIM/filetype.vim:
>>>
>>> augroup filetypedetect
>>>    au! BufRead,BufNewFile *.sage,*.spyx,*.pyx setfiletype python
>>> augroup END
>>>
>>>  
>> What I use is:
>>
>> autocmd BufRead,BufNewFile,BufWritePost *.sage set filetype=python
>> autocmd BufRead,BufNewFile,BufWritePost *.spyx,*.pyx set filetype=python.c
>
>
> I've seen that tip, but it's not really close to a solution, it's just a 
> dirty hack that has nothing to do with Sage (Python syntax != Sage syntax, 
> there's plenty of extra stuff in Sage).
>
> What I did for now is just exporting Sage keywords (there are 
> corresponding built-in functions for that) into Python syntax file, so I at 
> least get highlight for all functions and methods. You can find the file 
> here http://xsnippet.org/359006/. 
>
> I'd prefer having Sage syntax suger highlighting as well (like z.<x> = 
> ...), but didn't bother to implement it yet.
>  
>
> -- 
> Sincerely, Ruslan Kiyanchuk
>  

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to