I was thinking about my ideal haskell editing workflow:
Has anyone set up anything like this? The goal is to have hlint constantly watch my code for styling problems and for ghci be available for quick changes, without having to do anything other than saving the file in vim.
I was thinking of using something like watchr for the automation.
You can run arbitrary shell commands in vim using the BufWrite
autocommand:
For example, put this in your ~/.vimrc
:
au BufWrite *.hs !echo % >> ~/saves.txt
This will run echo <CURRENT FILENAME> >> ~/saves.txt
every time you save a haskell file.
So this is an easy way to trigger external scripts.
Now you can write some iterm scripts to relay commands to your other terminals. Something like:
tell my_ghci_terminal
write text ":r\n"
end tell
tell my_hlint_terminal
write text "<RUN HLINT ON WHATEVER>"
end tell
So you can use the vim autocommand to trigger the appropriate iterm script (passing the current file name so the script can tell ghci and hlint which file to process).
You'll probably want to toggle this on and off (you may not want to do this for EVERY haskell file), so think about wrapping the functionality in a vim function that lets you toggle it (as well as set arguments for how iterm should find your ghci and hlint terminals).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With