Jump to content

Snippets and input cursor


Recommended Posts

Hi All,

 

Alfred newbie here.

 

I'm intrigued by snippets.  I hope I can accelerate greatly using them.

 

One thing that I couldn't see how to do, though: indicate where the cursor should land once pasted.

 

For example, let's say I make the snippet '§proc' to expand to:

 

function () {

}

 

I'd like the cursor to be just before the (), so that I can type the function name and move on from there.

 

I have to move the mouse and click before the (), or use the arrow keys to get me there.

 

It'd be great if there were a placeholder to indicate where the cursor should end up:

 

function {cursor}() {

}

 

...or some such.


I looked in the documentation, but I couldn't find the answer. Can anyone point me to where this is documented?

 

-Ken

Link to comment

@Ken Corey No problem - happy to help!

 

As you're a new user, I thought it'd be worth mentioning that every preference pane has a question mark icon (including many sub-preferences panes) leading to the relevant documentation for the feature, so don't hesitate to click through.

 

Screen Shot 2017-07-24 at 11.02.05.png

 

For example, for snippets, you'll find a general feature description, links to setup and troubleshooting, how to use dynamic placeholders etc.

 

In the case of Workflow objects, we've included numerous example workflows that can either be added from Alfred's built-in selection, or imported to play with and discover the features :)

 

Of course, when you can't find an answer, this forum's full of lovely people happy to help you out!

 

Cheers,
Vero

Link to comment
  • 2 years later...

@chris Yup, looks like when I re-wrote the new Dynamic Placeholders page (now found here: https://www.alfredapp.com/help/workflows/advanced/placeholders/) I missed out the cursor. I've added it now.

 

It's a fairly self-explanatory one using {cursor}, and it's included in the placeholders list in-app (the square brackets bottom left of the Snippets content window includes examples of the various dynamic placeholders) but it's back in the docs now for completeness. :) 

 

Cheers,
Vero

Link to comment

Awesome, thanks. The thing I really want that seems missing is the ability to use {selection}, specifically for formatting HTML or Markdown syntax. For example, I have a snippet for creating HTML links, and I'd really love for Alfred to create the tags AROUND my text selection. 

 

Is this possible?

 

 330771355_CleanShot2020-06-18at17_20_46.png.7d0aa3513893fd567acdff75599964c8.png

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...