Jump to content
patgilmour

Send Snippet Directly to Terminal

Recommended Posts

Hi,

 

The new Alfred 3 Snippets are great - they replaced a lot of other text managers on my Mac.

 

One question: is it possible to create Snippets so that they will run directly as terminal commands (rather than having to create a Workflow element for each Terminal command I want to run).

 

Example:

 

"> killall PrinterProcessor"

 

If I create this as a Snippet, I can't find a way to get it into the Alfred window without copy n paste.

 

What I'd like to be able to do is invoke my snippet list, type (for example) 'killall', choose the snippet "> killall PrinterProcessor" and hit return to send it like any other Alfred command prefixed with > to the Terminal.

 

I there a simple way to do this?

 

Thanks,

Pat

 

 

Share this post


Link to post

Alfred doesn't expand snippets in its own query box.

 

TBH, I'd post that as a feature request. Would probably be very useful, and Alfred gets on just fine with other snippet expansion apps.

Share this post


Link to post

Yeah, think I will – it's pretty slow creating a workflow element for every Terminal command.

 

Alfred works perfectly with the other tools I was using – I just like it better so am migrating ;-).

Share this post


Link to post

What were you using before? I tried to switch to Alfred after the whole TextExpander debacle, but couldn't because it lacks basic snippet features like cursor placement.

Edited by deanishe

Share this post


Link to post

I was using Dash mainly - it has a snippet function that allows cursor placement (multiple with tab) - but I can live with Alfred way of doing things. Most of the complex cursor placementstuff I only need when I'm in my text editor (Atom) and it handles that well.

Share this post


Link to post
Yeah, I use UltiSnips (vim) for hardcore snippeting. Waaaay more powerful than any non-integrated snippet engine can be.
 
Couldn't live without cursor placement, though.
 

 

Have you tried Visual Studio Code? It's very much like Atom but massively less bloated and slow.

Share this post


Link to post

I'm on a MacBook Air 2011 and Atom runs okay here. Not as fast as my favorite – but too neglected by the taciturn developers – Espresso.

 

I took a look at Visual Studio Code, but am kind of in the Atom way of things and it works okay for me.

Share this post


Link to post

As per my response in your other thread:

 

If all you're looking to do is expand your snippets in Alfred, go to the Snippets preferences, click the cog and remove Alfred from the default ignore list. :)

 
Keep in mind that this could have adverse effects, e.g. expanding when you're searching in the Snippets Viewer using the snippet's keyword.
 
Cheers,
Vero

Share this post


Link to post

Thanks Vero.

 

The solution you suggest isn't too bad at all, but it requires more human memory I am capable of! It requires me remembering the expansion shortcuts for each of my commands.

 

What would be ideal:

 

- Invoke Snippets
- Filter and select Snippet
- Shift (or other modifier key) + Return to move this Snippet to the main Alfred execute window instead of pasting it.

 

Possible?

 

Thanks,

 

Pat

Share this post


Link to post

What does this have to do with snippets exactly?

 

Are these commands you also run in Terminal, or are you just looking for a way to put a list of shell commands in Alfred and run them from there?

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...