Skip to content

Instantly share code, notes, and snippets.

@davidfmiller
Last active December 6, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidfmiller/fe2de752c15b987befd31bd7c6726e66 to your computer and use it in GitHub Desktop.
Save davidfmiller/fe2de752c15b987befd31bd7c6726e66 to your computer and use it in GitHub Desktop.
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