Stan Shunpike
Stan Shunpike

Reputation: 2234

Can I connect Cygwin64 to Sublime Text 2?

I am trying to code using a functional programming langauge called Elm. From various sources, I received recommendations to use Sublime and Cygwin. I successfully set up Cygwin such that I can enter elm commands and it works. But I would think there should be some way to set up Sublime such that I can write the code in Sublime.

My Question

Can Sublime Text 2 run Elm by itself? Do I need to link Cygwin to it somehow to permit Sublime to run Elm code? I just want Sublime to be able to accept the commands I input like any coding interface. How can I set up sublime to run the Elm commands like Cygwin does?

For reference, here's Elm's website: http://elm-lang.org/

Upvotes: 1

Views: 324

Answers (1)

user4230165
user4230165

Reputation:

There should be no need to run Elm through Sublime Text - it's generally pretty simple to run the commands through the Command Prompt.

For development, all you should have to do is:

  1. Install the Windows installer (http://elm-lang.org/Install.elm)
  2. Create a folder for your Elm project (for example in "My Documents")
  3. Open the Command Prompt and cd to this directory - you can do this by typing "cd " (ie just three characters: c, d, and a space) then you can drag the folder with your Elm project into the Command Prompt and press enter (the Command Prompt should now have navigated to this folder)
  4. You can then type elm-reactor in this Command Prompt (this takes the .elm files that it finds in the folder and converts them over to Javascript and Html, and also runs a server that allows you to view the results in the web browser)
  5. Open Sublime Text to this folder to edit the files [*1] (also install Syntax Highlighting by searching Package Control for: "Elm Language Support")
  6. Open your web browser and go to the following address: http://localhost:8000

You should now be able to start developing. In the browser with localhost running, if you click on the wrench icon next to the file with your 'main' function the browser should update automatically when the files are changed (plus you get the time travelling debugger and other good stuff).

[*1] - you could start by jut copying over code from the Examples section of the Elm Lang website, then try modifying these to learn how it works, eg:

import Graphics.Element (..)
import Text (..)

main : Element
main =
  plainText "Hello, World!"

Note:

  • for building the project you can then use elm-make
  • for installing external packages (like elm-html) you you can use elm-package install <package_author>/<package_name> (you can find these in the libraries section of the Elm site)

Hope this helps! Elm's a lot of fun once you get started :)

Upvotes: 2

Related Questions