Steve Cooper
Steve Cooper

Reputation: 21500

In Visual Studio, find and commands by name?

I'd like to use the keyboard more in Visual Studio, and my memory for ctrl+alt+f??, alt+?? key combinations is failing me.

I'd prefer an adjunct like the emacs model, where it's possible to search commands by name; For instance, in emacs you type

alt+x enab <tab><tab>

and it presents you with a list of commands starting 'enab';

enable-command
enable-flow-control
enable-theme

I'd like to know if there is a shortcut or extension so that I could do something similar in VS, like

alt+x imm <tab><tab>

and then choose to execute one of

Debug.Immediate
Tools.ImmediateMode

Any clues?

EDIT

Both @Trillian and @the_mandrill have given me the right answers. It turns out there are two ways to enter the kind of mode I'm looking for;

1) The Edit.GoToFindCombo, which gives you a small bit of menu-bar space to type things like

>Debug.Immediate

2) The View.CommandWindow, which gives you a full panel (like the immediate window or the output window) which allows you to type in a bit more space and see the text output of executed commands.

It's also possible to alias commands in either window yourself, using the command window and a syntax like

alias sol View.SolutionExplorer

And to retrieve the current list like

alias

I've mapped Edit.GoToFindCombo to alt-x and View.CommandWindow to alt-shift-x and it's feelimg more emacs-y already :)

Upvotes: 1

Views: 741

Answers (2)

the_mandrill
the_mandrill

Reputation: 30862

Try using the Command Window (Ctrl-Alt-A). This brings up an emacs-like command buffer. Type:

Deb.Imm<tab>

to expand to Debug.Immediate. Typing the '.' forces autocompletion if there's one unique command (Debug is the only match for 'De'). Tab key will cycle through options. More info at the Command Window article on MSDN. There's also a list of Aliases that you can also add your own to, eg

alias di Debug.Immediate

I've also just discovered that you can type Ctrl-\ to set the focus to the Find pane and enter a command directly in there.

Upvotes: 1

Trillian
Trillian

Reputation: 6447

It would be nice if this was integrated in the Ctrl+Q Quick Launch box. Until then, the best built-in tool for this is probably the Go To Find Combo. You can use this to launch arbitrary commands by typing the '>' character and then the beginning of a Visual Studio command, including those you listed. You get autocompletion, but only for strings that start with what you're typing, so >Deb would list you all commands starting with Debug.. For your specific example, >imm would actually work because there is an immed shortcut to Debug.Immediate, but in general you'll have to know the prefix.

The Go To Find Combo is not in the VS2013 UI by default, but you can add it to any toolbar by selecting "Customize" and finding the command in the "Edit" category. Once it's sitting in a toolbar, the Ctrl+/ shortcut will give it the focus by default.

The '>' prefix for command completion also works from the Command and Immediate windows.

Upvotes: 1

Related Questions