Language Specific Snippets?

I’m looking for an app for the Mac that will hold dynamic code snippets for me for multiple programming languages. I’d prefer to essentially be in a .py file and when I insert a snippet with the for keyword, it’s specifically for python. That way I could also have a for for Java and other languages. The closest I’ve gotten to this is TeaCode from Apptorium but it doesn’t support all of the languages I’d like and doesn’t support cursor positioning.


I think there might be several different potential solutions to your problem.

One potential solution would be at the IDE level, I know that with sublime and visual studio code there are plugins for text completion and text shortcuts, and they tend to be language specific, there might be some preferences or you can roll your own.

My personal solution to this problem is a touch more involved but basically boils down to macros on steroids, what I do is I use a midi launchpad, I then have some software called Bome midi converter pro, which I use to listen for button presses on the launch pad, and then trigger specific macros. So I have a programmable grid of 64 buttons with two lines of 8 buttons which I use as control keys, so I simply flick between my java, JavaScript, and Nativescript modes and it works pretty great for me.

I also found that breaking system shortcuts onto a seperate pad of buttons was a lifesaver for my hands, (side note, command-x, command-c suck to use for a prolonged period of time).

Hope it helps and good luck searching

1 Like

I’m actually thinking about buying TeaCode via the 50% off deal of 2$ Tuesday:

Have you thought about contacting the Dev of TeaCode and suggested the feature?
It seems like a pretty reasonable request.

Instead of setting up expanders in the form of “for-php”, “for-py” and “for-js” to have “for”-loops in those three languages it should be able to detect the language beased on the filetype or editor’s setting.

Actually after checking again… TeaCode already checks the filetype and picks the language specific one.

What languages are you missing in TeaCode?

Regarding the cursor positioning:
If you place a # character it will position the cursor at that spot once the snippet has been pasted.

Yeah! I just figured out # places the cursor. I’d like for TeaCode to include Rust, and potentially superscripts of JavaScript distinct from Vanilla JavaScript (Typescript, React, etc.). Probably would be interested in more manipulation of variables as well. (Through shell scripts or apple scripts)