Pages

Sunday, August 10, 2014

Visual studio shortcuts

Visual Studio as any other IDE has many keyboard shortcuts and other useful tricks. And, naturally, users can adjust them. However there are developers who are not using most of them at all and even more of developers use only small subset of them. Partly because those hidden shortcuts are not that useful in general and can be quite specific and partly because of their hidden nature.

Let me list some of those I found:
First of all - navigation ones.
CTRL + arrow left or arrow right: Cursor position would be moved one word (not character!) left or right;
CTRL + arrow up or arrow down: The whole screen would be moved by cursor position would be still the same.
CTRL + [ or ]: move to the corresponding opening or closing bracket. Especially useful if you have a long cycle or if statement.
CTRL + Tab: navigation through opened tabs. If you have 2 opened files - you can switch them.

Next - some formatting tricks:
CTRL + SHIFT + U: make the selection upper case. One of the applications I have used: database store list of string values. And those can be upper case or lower case, and you need to compare them against a list of predefined constants. If you were given that list of constants in lower case you can transform them quite easily!
CTRL + L: removes the whole line

Selection:
If you hold SHIFT during cursor movement - you can select that area. More interesting options - you can hold SHIFT with other combinations. Like CTRL + SHIFT + Arrow Left would select the whole previous word; CTRL + SHIFT + END would select the whole text from the current cursor position to the very end of the file;
If you hold ALT you can select rectangle in the text. And it doesn't needs to be in the beginning of the line! Try it - hold ALT + left mouse button + move the button! Even more interesting - you can replace the selection with typing or pasting and it will replace each of selected lines!

Build:
ALT + B, U: builds current project only. It is like a separate keystrokes: Alt to activate menu, B to access Build menu and U to build current project. It can be shortened but that shortcut will always work.

Hope this helped!


No comments:

Post a Comment