aspenweb / simplate.vim Goto Github PK
View Code? Open in Web Editor NEWSimplate support for Vim
Home Page: simplates.org
License: Other
Simplate support for Vim
Home Page: simplates.org
License: Other
Auto-indenting doesn't seem to take in Python sections. E.g., I get:
if foo:
bar
Instead of:
if foo:
bar
And here's someone who used it for Jekyll front matter:
http://www.codeography.com/2010/02/20/making-vim-play-nice-with-jekylls-yaml-front-matter.html
Right now it's nothing.
@mattboehm sent me a simplate.vim in private email following a conversation at PyOhio:
I thought I'd take a stab at getting a vim syntax file working for aspen, since you mentioned it to me during PyOhio.
The attached file seems to cover the basic case (2 Python sections and 1 other section. I used html for convenience, but I suppose the actual default is a different templating language.) It requires that the syntax files for python/html be in the same directory so that it can import them.
It's somewhat hackish and extending this to support all possible simplate files would be a non-trivial effort. Still, hopefully if you choose to revisit this problem, my example provides some help.
It's worth noting that even if the syntax did work perfectly, other vim behavior that is filetype-specific (abbreviations, snippets, filetype-specific plugins, etc.) would not work out of the box. When people do want all this functionality in a file of mixed types, I usually point them towards https://github.com/chrisbra/NrrwRgn .
let main_syntax='simplate'
syntax include @Py <sfile>:p:h/python.vim
syntax include @Html <sfile>:p:h/html.vim
syntax region thirdBlock start=_\[---]_ end=_\%$_ contains=@Html
syntax region firstBlock start=_\%^_ end=/^\[---]/me=e-5 contains=@Py
syntax region secondBlock start=_^\[---]_ end=_^\[---]_me=e-5 contains=@Py nextgroup=thirdBlock
"syntax region firstBlock start=_\%^_ end=/^\[---]/re=e-5 contains=@Py
"syntax region secondBlock start=_\[---]_ end=_^\ze\[---]_ contains=@Py nextgroup=thirdBlock
The first [-----]
is hilighted even though it shouldn't be.
I don't follow. Was the intention to create .spt file type that properly highlights the all the sections in the simplate? If not, can we make it so? ๐
Rendered simplates have one content page (the last page). It should be syntax highlighted according to the filename extension.
Negotiated simplates have multiple content pages. They should each be syntax highlighted according to the media type on the specline.
I wonder if the best way to do this isn't to somehow import aspen from within Vim and use aspen as a library to determine the media type per page.
There is the literal page break control character and then there is "^L" -- both should be supported for separating pages.
This highlighting should be applied after the highlighting for the media type (#3) has been applied.
Now that we've got highlighting going for the various sections, we should highlight the speclines themselves.
I open a second simplate in a new tab with tabe
and I get no syntax highlighting on it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.