Skip to content

Tip 2.40: You can insert a snippet by pressing Tab Tab

May 14, 2010

“Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio”, courtesy of ‘Sara Ford’

Sara Ford’s Weblog

Sara Aside

A few months ago, Sara had dinner with some Microsoft MVPs and other Visual Studio users who were on campus for the Microsoft certification exams. One of the developers said, "Hey Sara, you need to blog about Snippet Tab Tab." She was blown away. She had tested this feature inside and out and never had heard of "Tab Tab." It turns out that he was just referring to the sequence of keystrokes you use to insert a snippet, but she never even thought to refer to it as the "Tab Tab" feature.


Sara’s not a C# developer. She spent the majority of her time writing code in Visual Basic during her
software testing days. Whenever she needed to use C#, she heavily relied upon code snippets because
she didn’t recall the syntax off the top of her head.

When in the appropriate place in the editor, you can type in the keyboard shortcut of a snippet, like for.

In this state, you can simply press Tab twice to insert the snippet.

Why twice? Press it once to autocomplete statement completion. If you just type f for "for", and for is
highlighted, you can just press Tab once to complete the word for
. Press it twice to generate the snippet,
since the cursor will be at the end of the word for in the editor.

And the moral of the story is "<snippet> Tab Tab."

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: