Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copy a UNIX command to your clipboard to return to the location of your cursor in the current file
(*
Copy UNIX command to return to current location in active BBEdit document
*)
tell application "BBEdit"
set mydocs to every text document in window 1
if (length of mydocs is greater than 0) then
set props to get properties of selection
set mydoc to first item of mydocs
set myurl to (URL of mydoc)
set myurl to ((characters 8 thru -1 of myurl) as string)
set command to "/usr/local/bin/bbedit \"" & myurl & "\":" & (startLine of props) & ":" & (startColumn of props)
set the clipboard to command
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment