On Mar 18, 2013, at 15:26, LuKreme <[email protected]> wrote:
> I'm pretty sure I used to be able to specify a full path in the file dialog
> goto and get bbedit to insert the contents of a dot file.
______________________________________________________________________
Hey There,
Hmm. I don't remember for sure.
>> If you type in an absolute path, or a home-directory-relative path, e.g.
>> “/usr/include/ errno.h” or “~/.bash_profile”, BBEdit will now show the file
>> if it exists at that location.
>
> But that doesn't seem to apply to the insert command.
You have to show hidden files first for it to work { Cmd-Shift-. | System-wide
keyboard shortcut for dialogs.}
Then Cmd-Shift-G to bring up the path-entry-field.
> Also, "Show Hidden Files" in the Open/Save dialog doesn't apply that
> preference to the Insert->File Content open dialog (and as noted in another
> thread, is not sticky but must be enabled every time).
Nor should it (imo), but perhaps those options should be available separately
in the insert dialog.
Here's a script to do it, and any valid posix path or home_dir abbreviation
should work.
~/.profile
OR
/Users/home_dir/.profile
Any quoting/escaping is taken care of by the script, so something like the
following will work:
~/curl dump 'file".txt
-------------------------------------------------------------------------------------------
# BBEdit
# Insert the contents of a file using a selected posix path.
# Supports home-directory notation '~/'.
-------------------------------------------------------------------------------------------
try
tell application "BBEdit"
tell front text window
set _file to selection's contents
set _file to replace "\\r+" using "" searchingString _file options
{search mode:grep, case sensitive:false}
if _file starts with "~/" then
tell _file
set qtFile to its (text 1 thru 2) & quoted form of (its text 3 thru
-1)
end tell
else
set qtFile to quoted form of _file
end if
set text of selection to do shell script "cat " & qtFile
end tell
end tell
on error e number n
set e to e & return & return & "Num: " & n
tell me to set dDlg to display dialog e with title "ERROR!" buttons
{"Cancel", "Copy", "OK"} default button "OK"
if button returned of dDlg = "Copy" then set the clipboard to e
end try
-------------------------------------------------------------------------------------------
Save the script and give it a keyboard shortcut.
Type your path directly in the BBEdit document.
Select the path.
Hit the keyboard shortcut.
--
Best Regards,
Chris
--
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.