Home / Tips / Code Snippets with TextExpander

Code Snippets with TextExpander


Hey, I want to share with you, my experience using code snippets with TextExpander, a tool I found out while listening to The Productivity Show, a podcast by Asian Efficiency.

TextExpander lets you instantly insert snippets of text from a repository of emails, boilerplate and other content, as you type – using a quick search or abbreviation.

I was already using code snippets for C# on MonoDevelop (as I mentioned in this post) but IMO this product has some advantages.

The snippets are:

  • Editor-independent (right now I’m using them for c# on MonoDevelop and Visual Studio);
  • Available in any computer;
  • Customizable with Javascript code.
While the first two are obviously important, it was the last that made me subscribe to the product. Let me give some examples of the customised snippets that I’m using right now:
Before you continue I must warn you that this is not a free product. You can try it for 30 days for free but then you need to subscribe it.

My code snippets


This snippet logs a message with any number of variables only on the Editor or Development builds.

.lg + TAB
code snippets with text expander
On this Window I can choose to log a message, one or multiple variables or a message with a list of variables.




This snippet generates the code to declare a private variable, changing the variable name according to the data type.

.prv + TAB
code snippets with text expander
Just choose the variable data type.


It’s also possible to choose where to place the cursor. I’m placing it before the semicolon, so it’s easier to add something more specific to the name.


This first one is a snippet can be used globally by other snippets. So each snippet that declares a new variable can use it.
This second one is the snippet that actually generates the code. You can see how it’s importing and using the first one at the beginning.

I’m certain that there are other solutions out there for this so please do share 🙂

Happy Coding

  • Facebook
  • Twitter
  • Google+
  • Linkedin
  • Pinterest
  • Reddit

Talk to me :)
%d bloggers like this: