Re: Clippings, options, auto-complete and keyboarding

2015-05-12 Thread Oliver Boermans
Hi Ted,

I understand, I too spent some time looking for an approach that was ever
so more slightly automagical. Interested to see what you come up with.

It is possible call a script to populate the text within BBEdit clippings:

 #script /Users/me/example/folder/Script.scpt#

Presumably this could open a dialog to present options before the clipping
is inserted.

Trouble was, I couldn’t see a mechanism to pass arguments to the script
upon execution. As a result every clipping would need it’s own script. This
makes the shortcuts BBEdit provides to edit and create clippings “on the
fly” less useful.

I went with requiring an additional shortcut to extract the options. This
had the possibly useful side effect of allowing the same mechanism to work
on any text selection – not just clipping contents.

Cheers
Ollie

—
@ollicle

On 12 May 2015 at 18:19, Gustave Stresen-Reuter 
wrote:

> Thanks for sharing! Not quite what I'm looking for but definitely on the
> right track. Ideally, I'd like something that is triggered when the
> clipping is inserted so I can just keyboard navigate through a dialog
> setting the required parameters. If I ever get any free time (not likely,
> but one can always hope) I'll take what you've done and see if I can work
> it into my own workflow and share that.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Clippings, options, auto-complete and keyboarding

2015-05-12 Thread Gustave Stresen-Reuter
Oliver,

Thanks for sharing! Not quite what I'm looking for but definitely on the
right track. Ideally, I'd like something that is triggered when the
clipping is inserted so I can just keyboard navigate through a dialog
setting the required parameters. If I ever get any free time (not likely,
but one can always hope) I'll take what you've done and see if I can work
it into my own workflow and share that.

Thanks again!

Ted

On Tue, May 12, 2015 at 12:52 AM Oliver Boermans  wrote:

> Hi Brian,
>
> I encountered the same issue and wrote some AppleScript to deal with it:
> https://github.com/ollicle/BBEdit-Extract-Placeholder
>
> Let me know if it works for you.
> Cheers
> Ollie
> —
> @ollicle
>
> On 12 May 2015 at 06:25, Christopher Stone 
> wrote:
>
>> On May 11, 2015, at 09:11, Brian Christiansen  wrote:
>>
>> When I'm using auto-complete with CSS, I get items like this:
>>
>> display:
>> <#none|inline|block|inline-block|list-item|run-in|compact|marker#>;
>>
>> Is there a way from the keyboard to select one of those options, that
>> isn't "highlight and delete everything that's not the option you want"?
>>
>> __
>>
>> Hey Brian,
>>
>> I'm not sure I understand exactly what you want, especially since I don't
>> do CSS.
>>
>> What I think I'm reading is that you want to be able to emplace the
>> clipping - then make a selection of the desired option via the keyboard -
>> and then remove the other options.
>>
>> What I've done is change the clipping text so that the options are
>> tokenized.
>>
>> You expand the clipping and  to the desired option - then you run
>> the AppleScript with a keyboard shortcut to remove the undesired text.
>>
>>
>> ---
>>
>> The Clipping:
>>
>> display:
>> @<#none#>|<#•inline•#>|<#•block•#>|<#inline-block#>|<#list-item#>|<#run-in#>|<#compact#>|<#marker#>@;
>>
>> * Items with bullets are reserved expansion-tokens in BBEdit.
>> * @ character marks beginning and end of replacement text.
>>
>>
>> ---
>>
>> tell *application* "BBEdit"
>>   tell front *text window*
>> set _sel to selection
>> set start_Line to *line* (get startLine of _sel)
>> set replaceText to *replace* "<#•?|•?#>" searchingString (_sel's
>> contents as *text*) using "" options {search mode:grep}
>> set replaceText to *replace* "\\@.+?\\@" searching in start_Line
>> using replaceText options {search mode:grep}
>> *select* *insertion point* after start_Line
>>   end tell
>> end tell
>>
>>
>> ---
>>
>> Let me know if I've got this wrong, or something needs adjusting.
>>
>> --
>> Best Regards,
>> Chris
>>
>>  --
>> This is the BBEdit Talk public discussion group. If you have a
>> feature request or would like to report a problem, please email
>> "supp...@barebones.com" rather than posting to the group.
>> Follow @bbedit on Twitter: 
>>
>> ---
>> 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 bbedit+unsubscr...@googlegroups.com.
>> To post to this group, send email to bbedit@googlegroups.com.
>>
>
>  --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
>
> ---
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Clippings, options, auto-complete and keyboarding

2015-05-11 Thread Oliver Boermans
Hi Brian,

I encountered the same issue and wrote some AppleScript to deal with it:
https://github.com/ollicle/BBEdit-Extract-Placeholder

Let me know if it works for you.
Cheers
Ollie
—
@ollicle

On 12 May 2015 at 06:25, Christopher Stone 
wrote:

> On May 11, 2015, at 09:11, Brian Christiansen  wrote:
>
> When I'm using auto-complete with CSS, I get items like this:
>
> display:
> <#none|inline|block|inline-block|list-item|run-in|compact|marker#>;
>
> Is there a way from the keyboard to select one of those options, that
> isn't "highlight and delete everything that's not the option you want"?
>
> __
>
> Hey Brian,
>
> I'm not sure I understand exactly what you want, especially since I don't
> do CSS.
>
> What I think I'm reading is that you want to be able to emplace the
> clipping - then make a selection of the desired option via the keyboard -
> and then remove the other options.
>
> What I've done is change the clipping text so that the options are
> tokenized.
>
> You expand the clipping and  to the desired option - then you run the
> AppleScript with a keyboard shortcut to remove the undesired text.
>
>
> ---
>
> The Clipping:
>
> display:
> @<#none#>|<#•inline•#>|<#•block•#>|<#inline-block#>|<#list-item#>|<#run-in#>|<#compact#>|<#marker#>@;
>
> * Items with bullets are reserved expansion-tokens in BBEdit.
> * @ character marks beginning and end of replacement text.
>
>
> ---
>
> tell *application* "BBEdit"
>   tell front *text window*
> set _sel to selection
> set start_Line to *line* (get startLine of _sel)
> set replaceText to *replace* "<#•?|•?#>" searchingString (_sel's
> contents as *text*) using "" options {search mode:grep}
> set replaceText to *replace* "\\@.+?\\@" searching in start_Line using
> replaceText options {search mode:grep}
> *select* *insertion point* after start_Line
>   end tell
> end tell
>
>
> ---
>
> Let me know if I've got this wrong, or something needs adjusting.
>
> --
> Best Regards,
> Chris
>
>  --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
>
> ---
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Clippings, options, auto-complete and keyboarding

2015-05-11 Thread Christopher Stone
On May 11, 2015, at 09:11, Brian Christiansen  wrote:
> When I'm using auto-complete with CSS, I get items like this:
> 
> display: <#none|inline|block|inline-block|list-item|run-in|compact|marker#>;
> 
> Is there a way from the keyboard to select one of those options, that isn't 
> "highlight and delete everything that's not the option you want"? 

__

Hey Brian,

I'm not sure I understand exactly what you want, especially since I don't do 
CSS.

What I think I'm reading is that you want to be able to emplace the clipping - 
then make a selection of the desired option via the keyboard - and then remove 
the other options.

What I've done is change the clipping text so that the options are tokenized.

You expand the clipping and  to the desired option - then you run the 
AppleScript with a keyboard shortcut to remove the undesired text.

---

The Clipping:

display: 
@<#none#>|<#•inline•#>|<#•block•#>|<#inline-block#>|<#list-item#>|<#run-in#>|<#compact#>|<#marker#>@;

* Items with bullets are reserved expansion-tokens in BBEdit.
* @ character marks beginning and end of replacement text.

---

tell application "BBEdit"
  tell front text window
set _sel to selection
set start_Line to line (get startLine of _sel)
set replaceText to replace "<#•?|•?#>" searchingString (_sel's contents as 
text) using "" options {search mode:grep}
set replaceText to replace "\\@.+?\\@" searching in start_Line using 
replaceText options {search mode:grep}
select insertion point after start_Line
  end tell
end tell

---

Let me know if I've got this wrong, or something needs adjusting.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Re: Clippings, options, auto-complete and keyboarding

2015-05-11 Thread Gustave Stresen-Reuter
IMHO the ability to select one from a list of items during a clipping
insertion operation would be a wonderful feature. That said, you can wire
up your own via AppleScript. I don't recall the exact technique but there
are a few examples out there on the web. Here's a short and easily read
link with some ideas on how to do it:
http://books.google.es/books?id=Ud9WZg-m87EC&pg=PA333&lpg=PA333&dq=create+a+custom+dialog+applescript&source=bl&ots=HOwxy-dixl&sig=9IreOrdzmaqTthyQeYwBqGYFwwc&hl=en&ei=r3M-SrCTMcOMjAeNjrQP&sa=X&oi=book_result&ct=result&redir_esc=y#v=onepage&q=create%20a%20custom%20dialog%20applescript&f=false

Good luck and let us know what you come up with.

Ted

On Mon, May 11, 2015 at 4:25 PM Brian Christiansen 
wrote:

> When I'm using auto-complete with CSS, I get items like this:
>
> display:
> <#none|inline|block|inline-block|list-item|run-in|compact|marker#>;
>
> Is there a way from the keyboard to select one of those options, that
> isn't "highlight and delete everything that's not the option you want"? I
> feel like I'm missing something. For the record, I don't know if this is
> from a built-in auto-complete lib, or a user-contributed clippings library.
> I didn't see anything in the clippings chapter of the manual that spelled
> out a non-mouse way of selecting one of the options.
>
> I feel like I could be making more use of the clippings feature,
> especially from the keyboard. Any additional tips beyond answering this
> query, or "you can assign shortcuts to specific clippings" (which I do) are
> welcome.
>
> I understand when I get options like this:
>
> margin: <#top#> <#right#> <#bottom#> <#left#>;
>
> That I can tab to each place holder and overwrite a value. That's great.
> That's the type of interaction I would like from the top sample. If there
> were a way of selecting one of those options (top sample) from the keyboard
> after an auto-complete, I would absolutely put that to work with a number
> of custom clippings.
>
> Thanks, all.
>
> ~brian
>
> @briandigital
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
>
> ---
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.


Clippings, options, auto-complete and keyboarding

2015-05-11 Thread Brian Christiansen
When I'm using auto-complete with CSS, I get items like this:

display: <#none|inline|block|inline-block|list-item|run-in|compact|marker#>;

Is there a way from the keyboard to select one of those options, that isn't 
"highlight and delete everything that's not the option you want"? I feel 
like I'm missing something. For the record, I don't know if this is from a 
built-in auto-complete lib, or a user-contributed clippings library. I 
didn't see anything in the clippings chapter of the manual that spelled out 
a non-mouse way of selecting one of the options.

I feel like I could be making more use of the clippings feature, especially 
from the keyboard. Any additional tips beyond answering this query, or "you 
can assign shortcuts to specific clippings" (which I do) are welcome.

I understand when I get options like this:

margin: <#top#> <#right#> <#bottom#> <#left#>;

That I can tab to each place holder and overwrite a value. That's great. 
That's the type of interaction I would like from the top sample. If there 
were a way of selecting one of those options (top sample) from the keyboard 
after an auto-complete, I would absolutely put that to work with a number 
of custom clippings.

Thanks, all.

~brian

@briandigital

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.