RayLoveless
RayLoveless

Reputation: 21088

visual studio. Hot key for pasting some specific text

I Find my self using jquery a lot in visual studio for my current project. Is there a way to add a hot key that will paste the guts of a selector on the screen? for example Ctr+shift+J will paste $("#").

Upvotes: 2

Views: 2072

Answers (2)

Dismissile
Dismissile

Reputation: 33071

Create a snippet:

Walkthrough: Creating a Code Snippet

What this will do is when you type a certain word (lets say selector in this case) and then hit the tab button, it will insert your snippet text that you defined.

Upvotes: 1

RayLoveless
RayLoveless

Reputation: 21088

Here's the macro solution:

  • Record a macro "Ctrl-shift-R"
  • Type specified Text (eg $("#").)
  • Stop Recording "Ctrl-shift-R"
  • Save your recorded macro: Tools-> macros -> save-temporaryMacro
  • Assign a shortcut key to your saved marco: Tools -> Options -> Enviornment -> Keyboard

Hope this helps someone. very nice!

Upvotes: 1

Related Questions