Jump to content

Using Dynamic Placeholders In Snippets


roads

Recommended Posts

No, this functionality does not exist in Alfred.

 

As I understand, placing the cursor in a text snippet is much less reliable than pasting (which Alfred does now). It would require using OS X's Accessibility API to actually simulate moving the cursor, which feels like a hack.

Link to comment

Apps like typinator can do this, I think even Launchbar can by placing a {^}. So we don't misunderstand each other, the feature request is to paste the snippet and have the cursor jump to the desired point within the snippet. I think you think I mean wargames like cursor typing which I am not.

Edited by roads
Link to comment

As Tyler suggests, Alfred doesn't use OS X's Accessibility features for text interaction, and as such, cannot reposition the cursor after pasting.

 

Having said that, depending on what you need to do, you could create a workflow which pastes a text snippet and populates additional text within the snippet in place (I assume that's why you want to reposition the cursor?)

 

Cheers,

Andrew

Link to comment

What I need it for Andrew is to adjust the snippet.Cursor movement is time consuming maybe even needs scrolling. Using the mouse is the option which isnt automatic either. A simple example would be.

 

Dear  <place cursor here>

 

blablabla

 

kind regards,
 

Peter

Edited by roads
Link to comment

That's the wrong kind of API. That's how to write scripts for Typinator to run. The app needs to support being scripted to write a workflow for it.

 

For TextExpander, for example, it'd be pretty easy to write a workflow that could search your snippets by name/abbreviation and trigger them from within Alfred. Helpful if you often forget the abbreviations.

Link to comment
  • 1 year later...

Now that Alfred 3 supports text expansion, and uses OS X's Accessibility features, is it possible to place the cursor?

 

In the past I've used textExpander for this, but I'm looking forward to getting rid of it as soon as alfred can support placing the cursor. :-)

Link to comment

Now that Alfred 3 supports text expansion, and uses OS X's Accessibility features, is it possible to place the cursor?

 

In the past I've used textExpander for this, but I'm looking forward to getting rid of it as soon as alfred can support placing the cursor. :-)

 

 

This isn't currently possible but it is something we'll be keeping an eye on. :)

 

Cheers,

Vero

Link to comment

I'd like to see this feature too. I'm using atext and usually use cursor placement in to speed up my coding workflow. 

Here's some of my snippet examples :

<!-- {cursor} --?> 

<div class="{cursor}"></div>

<p>{cursor}</p>

Link to comment

Oh, I thought this would already be implemented when I saw the first time the new snippet-feature announcement.

 

Would like to see this in the new snippet-insertion feature, too!

 

Examples:

 

1. Define (single) target of cursor

<p>{cursor}</p>

2. Define (multiple) targets to jump for cursor

Jumping via TABulature hotkey.

for({cursor_pos0}; {cursor_pos1}; {cursor_pos2}) {
    {cursor_pos3}
}

Have a nice day!

Link to comment

Oh, I thought this would already be implemented when I saw the first time the new snippet-feature announcement.

 

Would like to see this in the new snippet-insertion feature, too!

 

Examples:

 

1. Define (single) target of cursor

<p>{cursor}</p>

2. Define (multiple) targets to jump for cursor

Jumping via TABulature hotkey.

for({cursor_pos0}; {cursor_pos1}; {cursor_pos2}) {
    {cursor_pos3}
}

Have a nice day!

 

Cursor movement like this is best done in the editor itself. For example, Sublime Text allows snippets to have many cursor locations and you tab to each one to fill them in. That would never work for any generic application. It works for Sublime because the program is in complete control of itself already. It's not hacking the UI to get an effect.

 

My Quiver Snippet workflow (and the plain file version as well) uses Keyboard Maestro or TextExpander (which I quit supporting since I no longer use it) to move the cursor to a single location. The Keyboard Maestro solution is buggy since it is forcing the back arrow key. For short distances, it does fine. But for a lot of text, it misses quite often. Part of the bugs is that you are not sure when the system will paste the text to start the backtracking. When the system is running hard, even TE got it wrong a lot of the time. But, multiple locations would never work by stuffing the input buffer as these programs do.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...