Compile Idris to Vimscript, like you always wanted.
The good stuff.
Please note that this is very experimental. For example, the Idris
Integertype, usually represented as an arbitrary-precision integer, is represented using the Vim number type.
It's a hack, deal with it. 😎
Or, better still:
This is a fun project, and the authors aren't expert compiler writers: we need your help! There are three languages (Idris, Haskell, and documentation!) you can contribute in, and knowledge of Vimscript is useful too. Specifically:
If you have an idea in mind, open a PR!
Finally, if you write a Vim plugin using Idris Vimscript, let us know!
Many examples of what is possible are present in the examples/ directory, but this will give you an idea of the state of the art:
import Vimscript.FFI import Vimscript.List import Vimscript.Builtin
main : VIM_IO () main = do l
Build and Install
Install the code generator:shell stack install # or cabal install
Install the Vimscript library for Idris:idris --install vimscript.ipkg
Build and Run Examples
The project comes accompanied by a conveniencemakescript that will compile all the Idris files inexamplesfolder.make vim examples/loop.vim # :source % (in Vim)
In order to build a single example, you can compile it as below (this is whatmakeis doing).idris examples/myfile.idr -i lib/ --codegen vim -o examples/myfile.vim
BSD 3 License. Based on original work by Edwin Brady.