Jump to content

Auto-complete Snippet Keyword


Recommended Posts

I am using the "Snippets" feature. However, when typing my snippets, it is hard to remember the keywords themselves. Obviously, I can lookup the keyword itself or snippet name, but that is laborious and somewhat defeats the purpose of it being a snippet. Is there a way to enable autocompletion (e.g. TAB completion) of the snippet keyword itself?

 

For example, say I have a snippet like this:

 

"my_greeting" -> "Hello! It is nice to meet you! I hope you are having a good day!"

 

Thus, when I type "my_greeting", it will be replaced with "Hello! It is nice to meet you! I hope you are having a good day!".

 

But... what if I cannot remember "my_greeting" is the keyword ? I would like to type "my_" press TAB  (or some other key) and get a list of keywords I can select. 

Is this a feature that is already available and can be used? If not, what is the next best approach to mimic this?

Link to comment

@jy364398 There are three ways to access your snippets;

 

1. Text auto-expansion, which is the quickest and most efficient but requires that you remember your keyword

 

image.gif

 

2. The Snippet Viewer 

 

This is a great way to learn your snippet keywords for next time, as you can search for the snippet by title, keyword or content, and you'll see the keyword at the bottom of the preview. This is also convenient if you need to browse by collection when you're not sure of the snippet itself. Hit return to paste it.

 

image.png

 

3. The "snip" keyword

 

You can also type "snip" followed by the name or keyword of your snippet into Alfred's bar and hit return to paste it.

 

image.png

 

At this point, there are no plans to add a tab auto-complete, as tab serves many other purposes on your Mac, and it doesn't make sense for Alfred to take this over when there are already so many smooth ways to access snippets. :)

 

Cheers,
Vero

Link to comment

Dear Vero,

Thanks for this answer! This is very helpful! I would suggest that allowing the user to bind some sort of completion key (whether tab or something else) to snippets would be a great feature! The methods that you showed are great, but can be a bit inconvenient when there are many dozens of hard-to-remember snippets!

  

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