- Keep your hands on the keyboard as much as possible to avoid grabbing the mouse repeatedly.
- Use keyboard shortcuts like Ctrl+X, Ctrl+C, and Ctrl+V for cutting, copying, and pasting text.
- Hold down the select key to select text and use cursor keys to start selecting the text. Use "Page Up" and "Page Down" to select larger portions of text and use the cursor to finely tune the selection. Use "Home" and "End" keys to select an individual line of code.
- Use "Page Up" and "Page Down" keys to scroll a window's worth of lines. Press Ctrl and up or down arrows to move one line of code up or down per press without moving the cursor.
- Use "Tab" key to indent code and "Shift" and "Tab" to remove a tab or indentation.
With one of this month’s meeting topics being improving productivity with Visual Studio 2010, I wanted to share some productivity tips that work in any IDE on Linux and Windows.
One of my basic productivity premises is to keep my hands on the keyboard as much as possible. This allows you to keep from having to grab the mouse to do something and come back to the keyboard. Doing this hundreds of times a day adds up.
We all know about Ctrl+X, Ctrl+C, Ctrl+V for cutting, copying and pasting text respectively. Combining these commands with other keyboard commands is really powerful.
To select text from the keyboard, hold down the select key. With the select key held down, use the cursor keys to start selecting the text. Now you can do whatever you want to do with it. You could delete it with the “Del” key or cut to the clipboard with Ctrl+X. You can also select larger portions of text by holding down the select key and use “Page Up” and “Page Down” then use the cursor to finely tune the selection. To select an individual line of code, use the “Home” and “End” keys. I use these a lot, even without trying to select text, to go to the beginning and end of a line of code.
Moving around or scrolling can be done from the keyboard too. As I mentioned, the “Page Up” and “Page Down” keys will scroll a window’s worth of lines. To scroll without moving your cursor, press Ctrl and up or down arrows. This allows you to move one line of code up or down per press and you can see code that is just out of sight without moving your cursor.
With most IDEs you can select code and press the “Tab” key. This will indent the code over. To remove a tab or indentation, press “Shift” and “Tab”.
Debugging can be pain due to having to switch between windows. Press “Alt” and “Tab” will cycle to the previous window. If you want to continue going back to previous windows, keep holding the “Alt” key and press “Tab”. This will allow you switch between your IDE and program much quicker.
Code completion is one of the most important parts of an IDE. The majority of them use “Ctrl” and “Space” to bring up the window.
Your favorite IDE has a lot keyboard mnemonics. I highly recommend you learn them.