Sublime Forum

Using TextMate Commands

#1

I’m a long-time user of Sublime, and use it for pretty much anything. One of the few things I don’t use it for, however, is Arduino programming, as the Arduino IDE is necessary to compile and upload the code to the Arduino device. I’ve recently been looking into instead using Sublime for my Arduino development, and I managed to find a package on Package Control which can do all the syntax highlighting and such for Arduino sketches, which is great, but I still can’t compile and upload the code.

I had a look in the package and it does have a folder called ‘Commands’ with files such as ‘Compile.tmCommand’. I tried using the Command Palette but none of these appeared in it. After some searching I found that the .tmCommand files are command files for TextMate. I’m not sure how commands in Sublime work, and if there’s some way to use TextMate commands in Sublime, and if not why are these files included in a package made for Sublime? If anyone could help me I’d be very grateful. The package in question is located here: github.com/theadamlt/Sublime-Arduino

Thanks in advance!

0 Likes

#2

I think that even if you could compile, the simpler way to upload to the device would be using the IDE.

You could also use this command line utility (for Unix based systems such as Linux or Mac OS) ed.am/dev/make/arduino-mk … but I really wouldn’t know how to launch that from Sublime.

0 Likes

#3

I know nothing about Arduino but if you are looking to compile code then you should investigate build files on the Tools, Build System menu. These have the extension sublime-build. For example, my C++ build file looks like this:

[code]{
“cmd”: “g++”, “${file}”, “-o”, “${file_path}/${file_base_name}”],
“file_regex”: “^(…^:]):([0-9]+):?([0-9]+)?:? (.)$”,
“working_dir”: “${file_path}”,
“selector”: “source.c, source.c++”,

"variants":

	{
		"name": "Run",
        "cmd": "${file_base_name}.exe"]
		//"cmd": "bash", "-c", 
        //"g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
	}
]

}[/code]
You would select your build file from Tools/Build Systems, then Tools/Build (and possibly then Tools/Run). Although, the requirements for Arduino may not be so straight-forward.

0 Likes