Shell integration and BBedit?

164 views
Skip to first unread message

YKdvd

unread,
Feb 9, 2017, 5:20:19 AM2/9/17
to iterm2-discuss
BBedit can edit remote files using SFTP.  For instance, the command line tool lets you do something like:
   bbedit sftp://username@remotehost:port/path/to/file.txt
iTerm's shell integration lets you select text from a remote "ls" command and right-click to "Download with scp" (very nice!).  I was wondering if there was any way to combine the two, so that the context menu had an option like "Open with BBedit" which told BBedit to edit the file "in place" remotely with sftp instead of iTerm downloading it with scp?  There's no way for instance to install a user Applescript to provide a context-menu item, and which would have access to the selected text and the ssh_config info necessary to send BBedit an "open" command?
 
Just as handy would be some sort of shell integration "bbedit" command similar to imgls and it2dl so you could issue a command on the remote host like "bbedit /some/remote/file" which would trigger a bbedit  "open" request to edit that file via sftp.  But I think that would need new escape code support?

George Nachman

unread,
Feb 10, 2017, 12:56:57 AM2/10/17
to iterm2-...@googlegroups.com
You could actually do this already with a smart selection action since \d, \u, and \h get replaced with the directory, user, and hostname. Docs on defining smart selections and attaching actions is here: https://www.iterm2.com/documentation-smart-selection.html

What I'd do is define an action on the "paths" or "word bounded by whitespace" smart selection action and then attach an action that runs a command to open bbedit with the sftp path. A picture is worth a thousand words:

Inline image 1

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages