Click here to Skip to main content
Click here to Skip to main content

Custom Keybindings Add-In for Microsoft Visual Studio

, 24 Feb 2002
Rate this:
Please Sign up or sign in to vote.
Store custom keybindings in ascii file and transport between workstations.
<!-- Download Links --> <!-- Add the rest of your HTML here -->

CustomKeys add-in, source code, and documentation is Copyright © 2002 The Programmer’s Toolbox.

<![if !supportEmptyParas]> <![endif]>

CustomKeys Help

<![if !supportEmptyParas]> <![endif]>

License

You may distribute the CustomKeys binary freely, provided this notice and all other copyright notices remain intact. The Programmer’s Toolbox retains all Copyrights. You may not sell CustomKeys for any reason. Source code is available from http://www.TheProgrammersToolbox.com.

<![if !supportEmptyParas]> <![endif]>

Overview

CustomKeys was developed to deal with some rather irritating problems in Microsoft Visual Studio 6.0. For one, I often work at numerous development workstations. There is no good way to transport my customized keybindings between these machines. As a long time Emacs user, I am used to being able to customize my keybindings and use them across various workstations. Another problem is that MS Visual Studio has this nasty habit of trashing keybindings, but only after you set them all up. Also, in our lab, 4 or 5 developers may use a workstation. It would be nice to allow each one to maintain his own customizations and switch easily between them. For these reasons, I wrote CustomKeys. CustomKeys provides the following feature set:

<![if !supportEmptyParas]> <![endif]>

  • Stores keybindings in a regular ASCII text file.
  • Allows you to easily switch between different bindings files.
  • Allows you to transport customizations between workstations very easily.
  • Will not trash your bindings like MS Visual Studio.
  • You can call VB macros, other add-in commands, or any other available command.

<![if !supportEmptyParas]> <![endif]>

Installation

Most add-ins are dll’s stored in the Visual Studio add-ins directory. By default this is:

C:\Program Files\Microsoft Visual Studio\Common\MSDev98\AddIns

But, you can put the CustomKeys dll and help file anywhere you want.

<![if !supportLists]>1)       <![endif]>Start up Visual Studio.

<![if !supportLists]>2)       <![endif]>On the menu bar click Tools | Customize. The Customize dialog appears.

<![if !supportLists]>3)       <![endif]>Select the Add-ins and Macro Files tab.

<![if !supportLists]>4)       <![endif]>Click the Browse button in the lower right corner and navigate to the directory where you placed the CustomKeys dll and help file.

<![if !supportLists]>5)       <![endif]>Click the drop down list labeled Files of Type and change the filter to Add-ins ( .dll ) The CustomKeys file is now visible.

<![if !supportLists]>6)       <![endif]>Select the file and click Open. The dialog should disappear. You are back looking at the Customize dialog. The CustomKeys Add-in is now listed and the box should have a checkmark in it.

<![if !supportLists]>7)       <![endif]>Click Close. The Customize dialog disappears and the CustomKeys toolbar is visible. Drag this toolbar wherever you like.

<![if !supportEmptyParas]> <![endif]>

CustomKeys is now installed on your system.

<![if !supportEmptyParas]> <![endif]>

Usage

The CustomKeys Add-in exposes four commands:

<![if !supportEmptyParas]> <![endif]>

LoadBindings - Forces a refresh of the CustomKeys data file. The only time you should ever need to do this is if you edit the bindings file manually.

<![if !supportEmptyParas]> <![endif]>

KeyFileMaintenance - Brings up the main dialog through which you can insert, update, and delete key bindings.

<![if !supportEmptyParas]> <![endif]>

WhatIsCustomKey - Tells you what command is bound to a specific key combination.

<![if !supportEmptyParas]> <![endif]>

TranslateAndExecute - This executes the command associated with a custom key combination.

<![if !supportEmptyParas]> <![endif]>

The typical way to use CustomKeys is to use MS Visual Studio’s keybinding facility to bind just one method – TranslateAndExecute. I bind this method to Control – X. Although this binding is normally bound to Cut, I then simply rebind the X key to Cut. So, to do a Cut, I have to hit Control – X X.  It’s worth it to me because Control – X is an easy key combo, which then gives me access to all my other bindings. The only limitation in CustomKeys is that only Control, Shift, and keys A – Z are available for custom bindings. That still gives a lot of combinations, and they won’t interfere with the MS default built-in bindings. For instance, MS maps Control – S to Save. I like S for incremental search ( Another Emacs thing! ). So, to do an incremental search, I bind the S key to the built in command SearchIncremental. Now, to perform an incremental search, I hit Control – X S. Pretty cool. Another one I like is Control – X Control – B. In Emacs, this brings up the buffer list. I bind Control – B to WindowList. When I hit Control – X Control – B I get the window list containing a list of all my open files.

<![if !supportEmptyParas]> <![endif]>

Remember – My personal preference is to bind Control – X to TranslateAndExecute. You can use anything you want. To use CustomKeys, you must first call TranslateAndExecute, then your magic key combo. Notice how in my examples I always prefixed my custom keybindings with Control – X.

<![if !supportEmptyParas]> <![endif]>

Here’s a list of all the controls and what they do.

<![if !supportEmptyParas]> <![endif]>

Toolbar Buttons

There are three buttons on the CustomKeys toolbar. ( The tooltips will give you the command name )

<![if !supportEmptyParas]> <![endif]>

LoadBindings - Clicking this button forces a refresh of the CustomKeys data file. The only time you should ever need to do this is if you edit the bindings file manually.

<![if !supportEmptyParas]> <![endif]>

KeyFileMaintenance - This button brings up the main dialog through which you can insert, update, and delete key bindings.

<![if !supportEmptyParas]> <![endif]>

WhatIsCustomKey - This button will tell you what command is bound to a specific key combination.

<![if !supportEmptyParas]> <![endif]>

Dialogs

<![if !supportEmptyParas]> <![endif]>

File Maintenance Dialog

<![if !supportEmptyParas]> <![endif]>

<!--[if gte vml 1]> <![endif]--><![if !vml]><![endif]>

<![if !supportEmptyParas]> <![endif]>

<![if !supportEmptyParas]> <![endif]>

Insert - Brings up a dialog where you can add a new custom keybinding. Note that command names are case sensitive and must be entered correctly.

<![if !supportEmptyParas]> <![endif]>

Update - Allows you to edit the currently selected binding in the list.

<![if !supportEmptyParas]> <![endif]>

Delete - Deletes the currently selected binding from the list.

<![if !supportEmptyParas]> <![endif]>

SetFile - Allows you to specify the keybindings file to use. If the file you enter does not exist, an empty file will be created for you.

<![if !supportEmptyParas]> <![endif]>

If you have questions or comments about CustomKeys, drop me an email at feedback@TheProgrammersToolbox.com. Also, be sure to check for the latest version periodically at http://www.TheProgrammersToolbox.com. 

<![if !supportEmptyParas]> <![endif]>

CustomKeys add-in, source code, and documentation is Copyright © 2002 The Programmer’s Toolbox

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Dave Gallucci
Web Developer
United States United States
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 25 Feb 2002
Article Copyright 2002 by Dave Gallucci
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid