Productivity increase with keyboard shortcuts in Visual Studio and Visual Studio Code

Gergő Nagygyörgy
4 min readMay 15, 2020

Most of use want to become a 10x programmer unconsciously, even if she has never heard about what that means. I felt like adapting these techniques helped me get closer toward that unreachable ideal (pun intended).

One of the main reason I started looking for keyboard shortcuts in the first place, was because I've started to feel pain in my forefinger which I used to spin the mouse scroll with. So it was more like a must have at first, rather than trying to become faster or more efficient.

Second, a lot of the time I found myself scrolling through, back and forth in between files in the project, looking for a specific file I had in my mind. A lot of scrolling, searching and looking(or vice verse).

I was already using a couple of keyboard shortcuts which I learned throughout the course of being a software engineer. One of which is the navigate backward and forward. I stumbled upon it for the first time in Android Studio. The keys are Ctrl +Alt + Left arrow key to navigate backwards, and Ctrl +Alt + Right arrow key to navigate forward by default. I’ve gotten used to it, and since then I always configured the given IDE like mentioned. Navigating in between variables not visible in the current view port, classes, types, and in different files, switching back to where I left off, at the exact position of the cursor, really felt like it made me code faster. Going through a lot of layers of abstractions sometimes, I wind up long from the origin I started from, and when I get very low in the hierarchy, and I crawling back up without the navigation keys, I might even forget why I went down so far for in the first place. First exploring Flutter code base is a great example.

Combining navigation backwards and forward with go to definition (which is usually Ctrl + F12 by default) is another great example of a simple and effective shortcut. Which again, saves more time and energy to focus on the coding part, instead of playing the point and click game which I like to call it sometimes, using mouse for navigation.

Needless to say that I got back to using the mouse again after the pain is gone, but from time to time I always remind myself to forget about using the mouse and keep my hands glued to the keyboard. Maybe unplugging it would help.

I learned about an IDE function called GoToAnything using Sublime Text. After getting to know the code structure, I started using this function more and more confidently, and really got used to the speed with which I was able to navigate in the code base. The code base had a lot of distinct domains, so when I wanted to navigate to a SQL query about invoicing, I could type in ‘invoquer’ and than it matched the file I was looking for(the file called ‘invoicingQuery.js’), without having to touch the mouse as it was a goal of mine to achieve. Not having to close and open the folder structure in the Folders menu and search in the file hierarchy really saved me some time and get to the source code where I wanted to be at quicker. Visual Studio Code has it too, and they call it Quick Open, with the functionality being very close to Sublime Text.

Visual Studio calls the same functionality GoToAll. Which by default comes up by pressing Ctrl + ; or Ctrl + t. You can start by typing in ‘f’ which instructs the function to search for files only. Or if you’d like to search for a method, you can type in ‘m’ than a comma and than the method name. Although, its not mandatory to supply the very first switch character. You can just go ahead and type in what you are looking for.

Visual representation of the gotoall window with a question mark as input paramter, which shows all the available commands.
By typing in question mark, Visual studio will list the available switches.

Two things should be commonplace for keyboard shortcuts to really get the benefits of it:

  • Knowing and understanding well the business logic is key here. You have to know what you are looking for, not just the general direction, but the domain, and the specific space within.
  • Having well defined separate layers (models, view models, services, etc. layers)

Automatically save file changes without extra keystrokes

Ask yourself the question, how many times you save your work, automatically? You can save some mental processing power by enabling auto save in the IDE. For example Visual Studio Code has this feature by default. Visual Studio 2022 still does not. But there is an addon market place where there are plenty of them available. Combining auto save with auto format is also a great way to reduce some of the programmer’s useless habits. Grab this Visual Studio 2020 extension which works well with the previously linked auto save extension.

TL;DR

It is not about how fast you program, but the time you can save with leaving unnecessary doings behind and having more time to actually drive the project forward. All the while, working in your own pace.

--

--