I would like to create a building system in order to compile haskell files; note that I don't want to replace the common "CTRL+B" shortcut which runs the current file in a ST window.
so, following this messages, I created this file, located in the directory "/opt/sublime_text":
import sublime, sublime_plugin
class MakeHaskellCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command('exec', {"working_dir":"${project_path:${folder}}",'cmd': ["ghc","$file"]})
then, I modified the user key binding of the sublime-haskell package:
[
{
"keys": ["f1"],
"context": [
{ "key": "haskell_source" },
{ "key": "scanned_source" } ],
"command": "MakeHaskellCommand"
}
]
but after a restart of ST, nothing happens as I hit FN+F1.
can you help me?
EDIT thanks for your first message! It works, but now I have an other problem : I would like to delete all files in the directory, except the source file and the binary. I can launch this plugin:
import sublime
import sublime_plugin
class MakeHaskell2Command(sublime_plugin.WindowCommand):
def run(self):
variables = self.window.extract_variables()
args = sublime.expand_variables({
"working_dir": "${project_path:${file_path}}",
"cmd": ["rm", "*.hi"],
"cmd": ["rm", "*.o"]
}, variables)
self.window.run_command('exec', args)
but it does not remove the files. can you help me again for this?