Home Download Buy Blog Forum Support

Run arbitrary shell commands in Sublime

Run arbitrary shell commands in Sublime

Postby misfo on Wed Feb 08, 2012 12:55 am

Build systems are a pretty useful feature of Sublime, but for a lot of projects it's easier to just have a quick way of running arbitrary shell commands. If you're on a Ruby project, for instance, it's pretty wonky to create a build system for ["rake", "test"] and ["rake", "test:units"] and ["rake", "test:functionals"] etc.

I created plugin that's turned out to be pretty handy for me, and it's dead simple. Ctrl+Shift+C (Cmd+Shift+C) brings up a "shell" prompt right within Sublime. You can download it and check out out some documentation/screenshots here:
https://github.com/misfo/Shell-Turtlestein


Cheers,
Trent
misfo
 
Posts: 4
Joined: Wed Feb 08, 2012 12:44 am

Re: Run arbitrary shell commands in Sublime

Postby skaet on Wed Feb 08, 2012 4:42 am

I like your PAQ.

Also, nice :)
skaet
 
Posts: 93
Joined: Thu Sep 16, 2010 3:37 pm

Re: Run arbitrary shell commands in Sublime

Postby withoutclass on Wed Feb 08, 2012 9:56 pm

I don't see this listed in package control currently. Any plan of getting this into package control?
withoutclass
 
Posts: 4
Joined: Tue Aug 02, 2011 8:23 pm

Re: Run arbitrary shell commands in Sublime

Postby misfo on Thu Feb 09, 2012 3:35 pm

withoutclass wrote:I don't see this listed in package control currently. Any plan of getting this into package control?

I just sent a pull request to have it included: https://github.com/wbond/package_contro ... l/pull/147. Thanks for the suggestion
misfo
 
Posts: 4
Joined: Wed Feb 08, 2012 12:44 am

Re: Run arbitrary shell commands in Sublime

Postby Esente on Fri Feb 10, 2012 11:12 pm

Has been waiting for this ever since! Now I will just wait for it in Package Control and I'm happy!

Thanks!
Esente
 
Posts: 26
Joined: Mon Aug 16, 2010 7:20 pm

Re: Run arbitrary shell commands in Sublime

Postby misfo on Tue Feb 14, 2012 10:25 am

Esente wrote:Has been waiting for this ever since! Now I will just wait for it in Package Control and I'm happy!

Thanks!


It's up on package control now. Enjoy!
misfo
 
Posts: 4
Joined: Wed Feb 08, 2012 12:44 am

Re: Run arbitrary shell commands in Sublime

Postby ceej on Thu Feb 16, 2012 3:20 am

Thank you so much for this plugin. Quick question. How would you set your bin path to something else like "path": "/usr/local/bin:$PATH" ?
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Run arbitrary shell commands in Sublime

Postby ceej on Thu Feb 16, 2012 3:55 am

I have this https://gist.github.com/801c5fac14fe6f0441db but then no commands will run at all.....
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Run arbitrary shell commands in Sublime

Postby lawlist on Thu Mar 07, 2013 8:07 pm

I modified the file Shell Turtlestein.sublime-settings to add the paths needed, and I can now run a shell command within Sublime.

Code: Select all
{
   // Override these in your own
   // `Packages/User/Shell Turtlestein.sublime-settings` file.
   "surround_cmd": ["", ""],
   "exec_args": {"path": "/usr/texbin:/usr/local/bin:$PATH"},
   "cmd_settings": [],
   "input_widget": {
      // overridden for silly non-unixy OSes
      "syntax": "Packages/ShellScript/Shell-Unix-Generic.tmLanguage"
   }
}
lawlist
 
Posts: 54
Joined: Thu Feb 21, 2013 6:47 pm

Re: Run arbitrary shell commands in Sublime

Postby novice on Fri Jun 13, 2014 11:00 am

I don't have a github account, so I'am posting here:
I made some modification in the replace method:

Code: Select all
--- shell_turtlestein.py        2014-06-13 11:35:51.622084385 +0200
+++ shell_turtlestein.py.orig   2014-06-13 11:34:26.664581564 +0200
@@ -184,8 +184,8 @@
     Replace the text in the specified region with the specified text
     """
     def run(self, edit, region_start=None, region_end=None, text=None):
-        if region_start is not None and region_end is not None:
-            self.view.replace(edit, sublime.Region(region_start, region_end), text.strip())
+        if region_start and region_end:
+            self.view.replace(edit, sublime.Region(region_start, region_end), text)
         else:
             self.view.insert(edit, 0, text)



This fixes a problem when the selection starts at the beginning of the view and removes the trailing new line from the new text.
novice
 
Posts: 5
Joined: Sat Mar 09, 2013 4:44 am


Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 14 guests