TextMate + Shell from IDE!

Mac OSX specific forum
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

TextMate + Shell from IDE!

Post by Piero »

This can also be useful to "quickly setup" shell stuff from IDE (but you can only use 'single quotes' on IDE tool settings…)

Code: Select all

; PB IDE tool to edit current code with TextMate (needs /usr/local/bin/mate; see Prefs/Terminal)
; Arguments: /usr/local/bin/mate -wl%SELECTION '%TEMPFILE'
; Options: Wait until tool quits, Hide Editor, Reload (into current source) after tool has quit

Procedure simpleShell(ShellCommand$)
   Protected shell = RunProgram("/bin/sh", "", "", #PB_Program_Open | #PB_Program_Write)
   If shell
      WriteProgramStringN(shell, ShellCommand$)
      WriteProgramData(shell, #PB_Program_Eof, 0)
      While ProgramRunning(shell) : Delay(10) : Wend
      CloseProgram(shell)
   EndIf
EndProcedure

j = CountProgramParameters() - 1
For i = 0 To j
   a$ + ProgramParameter(i) + " "
Next i

If FindString(a$, "/usr/local/bin/mate -wl") = 1 ; format %SELECTION for mate
   a$ = StringField(a$, 1, "x") + ":" + StringField(a$, 2, "x") + "-" + StringField(a$, 3, "x") + ":" + StringField(a$, 4, "x")
EndIf

simpleShell(a$)

simpleShell(~"osascript \n tell app \"purebasic\" to activate \n beep \n say \"done!\" ")
 
…and DON'T MISS THIS PB TextMate bundle!!!
 
Last edited by Piero on Sun Oct 06, 2024 9:47 am, edited 2 times in total.
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Update

Post by Piero »

The ALPHA bundle is getting better…
You can now download the newer version (always on link above)

Video
 
 
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Mostly Done!

Post by Piero »

I don't need scopes etc. (at least for now…)

Also added help stuff for TextMate…


Enjoy!
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Forum Command :)

Post by Piero »

Squashed the "bug" that was sometimes slowing down TM osascripts
Also added:

Code: Select all

"Wrap for Forum"
to get bbcoded selection on clipboard (needs gecho)
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Small fix

Post by Piero »

Small (but I think useful) fix to "Check & Goto 1st Error"
You can fix it yourself duplicating a line without redownloading the bundle:

Code: Select all

-- 2 times to always get tooltip on the right spot:
tell application "TextMate" to get url "txmt://open?line=" & third word of a & "&column=1"
tell application "TextMate" to get url "txmt://open?line=" & third word of a & "&column=1"
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Well…

Post by Piero »

I think I'm done with this bundle (as an example that you can "expand")

Added a PB Light color theme, similar to PB default; on readme there's a link to easily modify themes or create new ones (also see System Color Picker)
Refined the shell stuff that was in "bug testing stage"
Added "Create link for Forum" (I did it using LaunchBar before, but this is a bit better)

Don't forget to "install" the PB IDE tool, and to see how to setup the fuzzy autocomplete (I have the support text file in "~/bin"; that's a "bin" folder in my home folder)… I also made "two" fuzzy autocomplete for the PB IDE (one is to "search" all open documents…)

Suggestions, Bug Reports and Questions Welcome (but before: this bundle is already full of help stuff) ;)

Special thanks to HeX0R; you made me drink a lot of beer! (see the smart indent source code for USEFUL infos and options)

Explore and… HAVE FUN!
Piero
User avatar
HeX0R
Addict
Addict
Posts: 1204
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Well…

Post by HeX0R »

Piero wrote: Sun Oct 06, 2024 9:34 amSpecial thanks to HeX0R; you made me drink a lot of beer! (see the smart indent source code for USEFUL infos and options)
:twisted:
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Well…

Post by Piero »

HeX0R wrote: Sun Oct 06, 2024 7:32 pm:twisted:
1st of all, Thank You!
I tried to make Smart Indent work with selection (not the entire source code) and also to make the dialogs "modal/frontmost" (it was a problem if they stayed on background…) but didn't waste too much time (I had to improve the bundle); I coded the indentation, but it has a (very small) problem with "select-case", and I'm not the only one that got into this……

Resuming: Thanks for the beers! ;)
Post Reply