Jump to content

Tab Through Snippet Expansion

Recommended Posts

I have a snippet that I need to replace several locations with variable text each time I paste it. Is there  a way to have cursor placed initially, then "tab" to the next location to replace a placeholder?




Title {placeholder1}

URL: {placeholder2}

- {placeholder3}


Where each successive tab would jump to placeholder and highlight it for replacement?

Thank you!

Link to comment

No. Alfred can’t reasonably intercept TAB keypresses in another app. That only works with snippet engines built into an application (they can hook into the editor API).


Alfred can’t do it because it has no way of knowing whether TAB will insert a tab character, a number of spaces or move focus to another GUI element, therefore it can’t undo the TAB keypress in the same way it can a snippet trigger (by simulating the appropriate number of backspace presses).


With Alfred, your only real option is to use a Snippet Trigger to pop up Alfred, then use a few Keyword elements and Arg & Vars elements to ask for your different inputs. Finally, you can use a Run Script to combine the variables into the complete output, then a Copy to Clipboard action to paste it back to the app.


Other snippet expanders have a dedicated GUI for this kind of snippet. If you have a lot of such snippets, it may be worth looking at something like Typinator: it’s far less work to set up such a snippet than with Alfred. 

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