Emacs gets all the cool modes
So here's my attempt to make things a bit more smooth for vim.
Rather than using
:e in Idris to load your
EDITOR, idris-mode uses a script to
start a tmux session with two panes: one on the left for editing Idris code using
Vim and one on the right for running the Idris repl.
Using some vimscript it creates an Emacs-like mode so that you can see the code you're working on and the state of the Idris repl at the same time.
- tslime vim plugin (specifically https://github.com/jgdavey/tslime.vim as it is the most up to date)
Start idris-mode using by running:
script in your Idris project folder. You can put this script somewhere in your path, or symlink it, or whatever you prefer.
This will load a tmux session with a vim pane on the left and a idris session on the right.
Default leader keys
I have set up the plugin with some defaulted leader keys. If you'd rather I didn't let me know.
<leader>ihdisplays Idris help on the Idris pane.
<leader>ilwill take the current vim buffer and load it into Idris.
<leader>irwill reload the current file.
<leader>icwill compile the current file (giving it the same name minus file type).
<leader>imshows the remaining metavariables to be proven.
<leader>iplooks for a metavariable in the code and starts a proof of that hole.
<leader>iaAssumes :a done in Idris repl pane first. Moves the proof below where the proven metavariable occurs
<leader>iqquits Idris and closes the Idris pane.
If you are editing an idris file and save, an autocommand will load it into idris
and thereby checking it for type correctness. This pretty much makes
redundant... But you never know.
Some weird file loading stuff goes on when trying to send :a to the idris pane followed by trying to reload the file and move the proof. So right now after proving a metavariable in Idris repl, you have to:
:ain the Idris repl
- move back to the vim pane
<leader>iato reload the file and move the proof just below the metavariable
idris-mode has also only been tested on really simple files, like test2.idr. I can't guarantee that moving the proof will always be correct. So at the moment if it does get placed wrong, you'll need to tweak it manually.
Issues, Pull Requests, etc
If you find any problems, create an issue and supply the code and the commands you are trying so that I can reproduce and fix it. Either that or create a Pull Request :)