Ken Corey Posted July 22, 2017 Share Posted July 22, 2017 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
Vero Posted July 22, 2017 Share Posted July 22, 2017 Hi @Ken Corey Welcome to the forum! To position the cursor, you're very close - it's {cursor} in curly brackets You can find out more here, and see the rest of the available dynamic placeholders: https://www.alfredapp.com/help/features/clipboard/dynamic-placeholders/#cursor Cheers, Vero Link to comment
Ken Corey Posted July 24, 2017 Author Share Posted July 24, 2017 Doh! I should have just tried it. *blush* Thanks! Link to comment
Vero Posted July 24, 2017 Share Posted July 24, 2017 @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. 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
Chris Messina Posted June 17, 2020 Share Posted June 17, 2020 On 7/22/2017 at 2:23 AM, Vero said: You can find out more here, and see the rest of the available dynamic placeholders: https://www.alfredapp.com/help/features/clipboard/dynamic-placeholders/#cursor Hey @Vero— looks like that link is broken? The Cursor section is missing on that page? Link to comment
Vero Posted June 18, 2020 Share Posted June 18, 2020 @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
Chris Messina Posted June 19, 2020 Share Posted June 19, 2020 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? Link to comment
deanishe Posted June 19, 2020 Share Posted June 19, 2020 8 hours ago, chris said: the ability to use {selection} What is {selection}? Link to comment
Chris Messina Posted June 19, 2020 Share Posted June 19, 2020 For example, when I highlight text. Or maybe it's clearer to say "selected text"? This would be particularly useful if I could add a keyboard shortcut to a snippet. Link to comment
Andrew Posted June 19, 2020 Share Posted June 19, 2020 @chris If you create a workflow, you can configure a Hotkey Trigger to take the currently selected text in macOS, then you can connect this into a "Copy to Clipboard" object set to automatically paste. Put your snippet content in that second object, and use {query} for the scooped in selected text. Chris Messina 1 Link to comment
deanishe Posted June 20, 2020 Share Posted June 20, 2020 15 hours ago, chris said: Or maybe it's clearer to say "selected text"? That's what I thought. But I don't think it's possible to type a snippet trigger and have selected text at the same time. Link to comment
Chris Messina Posted June 20, 2020 Share Posted June 20, 2020 Yeah, I realized that after you asked that, lol. My bad. But I do think that what @Andrew suggested will work — just a little more work! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now