Home Download Buy Blog Forum Support

Using TextMate Commands

Using TextMate Commands

Postby seanduffy on Sat Dec 22, 2012 8:24 pm

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: https://github.com/theadamlt/Sublime-Arduino

Thanks in advance!
seanduffy
 
Posts: 1
Joined: Sat Dec 22, 2012 8:18 pm

Re: Using TextMate Commands

Postby pier on Sat Dec 22, 2012 9:25 pm

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) http://ed.am/dev/make/arduino-mk ... but I really wouldn't know how to launch that from Sublime.
pier
 
Posts: 92
Joined: Fri Jun 15, 2012 2:47 am

Re: Using TextMate Commands

Postby agibsonsw on Sat Dec 22, 2012 10:08 pm

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: Select all
{
   "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}'"]
      }
   ]
}

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.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to General Discussion

Who is online

Users browsing this forum: demetris, Google [Bot] and 28 guests