I like working with the Sublime Text 2 editor and I surely like to work with FSharp so I’ve been trying to find ways to make life easier for myself. A few tips to pass along:
- Get the F# Textmate Bundle. Once you get it, unzip it into the ~\Application Data\Sublime Text 2\Packages directory. In my case I created a F# directory under the Packages directory.
- Add the following settings via the File Settings-User menu
"tab_size": 4, "translate_tabs_to_spaces": true
- To make it easier to compile and build your app, create a couple of environment variables: MSBuildBin and FSBin. In my case I set the MSBuildBin to the directory where the MSBuild.exe is located and I set FSBin to the directory where Fsc.exe is located.
Under the ~\Application Data\Sublime Text 2\Packages\User directory, create a file called msbuild.sublime-build and put the following in it:
{ "path": "%FSBin%;%MSBuildBin%", "cmd": ["msbuild"] }
Once you do this, on the Tools->Build System menu, you should have an msbuild option. If you select the msbuild option from the build system you should be able to build your FSharp app with an msbuild *.proj file. You can grab the lines from the output via a Perl RegEx if you want but I’ve not done anything so complex up to this point.
I’m working on adding the ability to shell out to the fsi.exe utility. If I make any progress with that, I’ll post on it here.
UPDATE: See Leaf’s comment below for information on adding a REPL to Sublime Text 2. Great many thanks Leaf.
Also, here is a Gist of a small, modest F# shell script to kick off Sublime Text 2 adding git into the path for the ST2 git plug-in.
Technorati Tags: F#,SublimeTextEditor,Tools