Development Category

VS 2012: Add external editor in your file context menu & keyboard shortcuts

So recently I had to deal with some Cold Fusion code and since I had no tools (and no desire to install Eclipse, Abode etc. products just so I can get the syntax of CF looking colorful) I decided to get VS 2012 work with an external tool which had the CF syntax highlighting etc.

In this article I will try to go over how I did that and hopefully that would be helpful to someone else …

Step 1: Install your external editor
Step 2: Go to Visual Studio 2012 Tools / External Tools...
Step 3: Click Add
Step 4
: Provide your title, in the command line select the executable of your editor (in my case Sublime Text).
In the arguments select $(ItemPath) and in the Initial directory $(ItemDir)
Step 5
: Move it to the top of the list (it matters as we will explain later why)
Step 6: Click Apply

2013-03-07 13_33_53-External Tools

Ok so what we have done so far is to have our external editor in the Tools menu in VS2012:

2013-03-07 13_33_53-Tools_Editor

Now let’s add it to the file context menu so we get this:

2013-03-07 13_33_53-ContextMenu

Step 7:   Right click on the VS 2012 Menu (the one with FILE, EDIT etc)
Step 8:   In the context menu shown select last item “Customize…
Step 9:   Click on the “Commands” tab
Step 10: Select the “Context menu:” radio button
Step 11: From the combo box find the “Project and Solution Context Menus | Item

2013-03-07 13_33_53-CustomizeTab

Step 12:   Click on the “Add Command…” button
Step 13:   From the popup dialog select the “Tools” item in the Categories List
Step 14:   From the Commands list select “External Command 1” (This is why we moved the editor to top position.
You have to match its position in the Step 5 to the ExternalCommand X item)
Step 15:   Click “OK” button – this will close the “Add Command” dialog. (Do not close the Customize dialog!)
Step 16:   Click on the “Keyboard…” button now.
Step 17:   From the quite small list in the middle of the dialog find “Tools.ExternalCommand1” as shown:

2013-03-07 13_49_36-Options

Step 18:   Set your shortcut in the “Press shortcut keys” text box. Note: if the shortcut is already used VS will show you which command is currently using your key combo in the “Shortcut currently used by” combo box.
Step 19:   After you have selected your shortcut you should be good to go now.

Hope this helps.

Born in a small country in the Balkans called Bulgaria (commonly mistaken by the geographically inclined westerners as Siberia), @krion spend most of his childhood being deceived that his existence mattered and that he can change the world one school year at a time.

One Response to “VS 2012: Add external editor in your file context menu & keyboard shortcuts”

  1. Jim Little Reply

    This is pure genius!!! Thank you for being SO CLEAR in the steps required–great job!

Leave a Reply