Welcome to Machine Unix

Search Below

TextExpander Insanity

If you are using a Mac, and if you have not heard of TextExpander regardless of your Job, you should totally check it out.

It is a shortcut typing utility which will let you assign hotkeys to anything!. You can use it to create emails, notes, command line shortcuts and many more. I’ve been using the utility for such things, but lately I am using it to create for something else!

So, I’ve started refreshing my C programming Language knowledge from my College days and after writing more and more short codes, I became very lazy to type things over again ( If you are a programmer, you should probably not do the following  ).

If you are writing some short code just like I do then you realize that a C code ( again in short form ) generally looks like the following:

include statements

define statements

int main(void)


variable definitions



return 0;


But would not it be easier if I was to assign a short cut and embed this template? With TextExpander, this plays nicely. Take a look at example below:


What I have here in the template above is that I created a small C code template and assigned a shortcut code to something what I called “#incs”. So whenever I type “#incs” to my IDE or my VI session, the application automatically replaces the contents of the shortcut with “#incs”.

The following is the image in action:


After filling up whatever I need into this template, the app does the following when I hit the “OK” button!:


So, the app inserted what I needed, and now I can focus on coding too.

Here is the Snippet for the TextExpander App:

/* %clipboard — %fill:Description% */
%fillpart:name=define statements1?%#define %fill:Constant1% %fill:Value1%%fillpartend%
%fillpart:name=define statements2?%#define %fill:Constant2% %fill:Value2%%fillpartend%

int main(void)

return 0;

You can probably modify things a little bit. For example I am doing things like adding a clipboard copy of the program name in the first line above ( laziness ! ).  The second and third line of the Snippet contains the define statements part, and the rest of the lines are for the main part of your C program.

Happy TextExpanding and Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>