i have managed to make a code snippet and its all good, the question is i dont want to use ctrl+k ctrl +S then click on the snippet , instead i want to use a combination of keys to just use the snippet right away , or at least pressing ctrl+k ctrl + S then another combination ?
is that possible ?
thanks in advance…
If you say you’re pressing
Ctrl+K, Ctrl+Sis because the snippet you added was a Surround With snippet, isn’t it?I suggest you installing ReSharper for this purpose. You can easily add all kind of snippets (called templates in ReSharper), and of course, Surround-With snippets.
After adding a template, you can give it the number you want.
Then all you have to do is press:
Ctrl+Alt+Jand you will see the following:And all you have to do is press the number of the snippet you want.
For example, if you want to surround some code with an
if, you press:Ctrl+Alt+J, 1.Note:
In this moment, I don’t really remember if
Ctrl+Alt+Jis the keyboard shortcut by default, because I have changed many of them, but you can check it in ReSharper > Edit > Surround With Template…