IDE Keyboard Shortcuts To Improve Productivity

The third post in our 'Know Your Damn IDE' series
Pere Daniel Prieto
Pere Daniel Prieto
May 2, 2019

Developers spend most of their time coding. Writing code is not too dissimilar to writing a dissertation or even writing a poem. You need inspiration, a calm environment and, most importantly, focus. Small distractions are usually the main culprits that impact performance, especially when writing. In today’s post, I want to take a look at the ways in which developers can utilize IDE keyboard shortcuts to improve productivity.

One of the distractions I personally struggle with the most, believe it or not, is using my mouse to complete tasks. It sounds silly but put yourself in my shoes. I’m working on a really complicated task involving some major code changes. I’ve developed a completely new algorithm that performs the task in the best way possible. I’m focusing all of my energy on writing down the details into my IDE of choice. I’m in a Zen-like state, somewhat akin to the Matrix, where nothing else exists around me. It’s just me, the keyboard and a brain full of ideas.

It’s finally complete! Now I just need to invoke the algorithm from the point in the code where it’s needed and damn! It’s in a different file and I need the mouse to open it. No problem! I’ll just go and grab the mouse and…

….wait, what was I doing?!

If, like me, you find yourself getting easily distracted whilst working within your IDE, you’re going to want to unleash the power of IDE keyboard shortcuts!

What are IDE keyboard shortcuts?

As I mentioned in my post on how to use IDEs effectively, we must always be aware of the difference between knowledge and usage: it is important to know that a feature exists in order to use it. This is particularly important for shortcuts.

According to Wikipedia, a keyboard shortcut is a ‘sequence or combination of keystrokes on a computer keyboard which invokes commands in software’.

A keyboard shortcut allows easy access to a command (or sequence of commands) in your software. It’s important to remember that you can only invoke commands that are already implemented in your software. Therefore, if a command is not available in your software, there won’t be a shortcut for it and you won’t be able to set up a custom shortcut either.

With great power comes great responsibility!

Shortcuts are an extremely useful feature in almost any software, particularly in IDEs where a lot of commands (aside from the code editor itself) are available to the user. Nevertheless, it’s also really easy to abuse them.

How is that so? Us developers love the sound that our keyboards make when we’re tapping away at them. It’s thus common practice to favour keyboard over mouse usage for almost? everything. The mouse often gets abadoned in the corner of our desks. This doesn’t mean that you need to go out and commit every single keyboard shortcut to memory, however.

As I mentioned in our post on using your IDE effectively, whilst I know Sublime Text has a shortcut to enable multi-addition of several lines simultaneously, I have to search for it whenever I need to use that feature because I only use it a handful of times per year.

From personal experience, I would suggest that every shortcut you use should come naturally to you as a part of your daily typing. That’s to say that keyboard shortcuts must be memorised by your hands and not by your mind. If you end up having to spend time thinking about the keystroke combination you need in detail, the purpose of using a shortcut is completely lost!  

Shortcuts are meant to optimise your time; therefore, you should only be aware of those that you use on a daily basis since they will save the greatest amount of time.

Finally, if your IDE of choice allows you to customise your shortcuts or define new ones, don’t hesitate! Give it a try.

Some combinations are pretty complex. Mapping out those commands and customising them into a much simpler combination will save you time and energy!

Top 13 XCode keyboard shortcuts.

As I’ve mentioned in previous blog posts, I like to lead by example. As such, here are my top 13 XCode keyboard shortcuts (for version 10.2).

app development blog
  • Cmd + Shift + O: Displays the ‘Open Quickly’ dialog. A really useful tool when searching for a particular file (even non-code files!) or declarations (including properties, functions, protocols, structs or classes). It displays a list of matches and you select the one you’re after.
ios development blog
  • Cmd + Shift + J: Reveals the file currently being editing in the project navigator.
app cevelopment blog
  • Cmd + Shift + L: Displays the ‘Snippets’ dialog. A useful tool to add pre-defined code snippets into your code. When editing a Nib file, it will display the ‘Objects’ dialog that enables us to add view objects into the current file.
ide keyboard shortcuts
  • Cmd + F: Search in current file. Searches for a string in the file that’s currently being edited. Searches can be refined, making it easier to find what you’re looking for.
    Cmd + Alt + F: Search and replace in current file. Same as above, with the replace option.
xcode keyboard shortcuts blog
  • Cmd + Shift + F: Search in project/workspace. It has the same options as Cmd + F for the most part but the scope can be focused within a single folder, the whole project or a different module altogether.
we are mobile first blog
  • Cmd + Shift + Alt + F: Search and replace in project/workspace. Same as above with the replace option.
  • Cmd + B: Build the current project. XCode runs the compiler in the project but doesn’t run it on the simulator.
  • Cmd + R: Run the current project. Same as Cmd + B but runs the executable in the simulator or device selected as target.
  • Cmd + U: Run tests. Same as Cmd + R but XCode executes tests on the app instance that is running instead of enabling user interaction.
  • Cmd + Shift + Alt + K: Cleans the project build folder. Usually, when building on Xcode only, some files are recovered from a cache. Running this command cleans these legacy artefacts.
  • Cmd + ‘number’: Changes the view of the lefthand side menu (containing the project navigator) to the tab in position ‘number’.
  • Cmd + <: Edits scheme.
ide keyboard shortcuts to improve productivity

Why use IDE keyboard shortcuts?

Keyboard shortcuts are powerful tools that can save you a lot of time when used properly. Fail to use them adequately and you’ll be left with a headache!

As with any other feature you use during the development process, it’s important to know what your IDE both can or cannot do and use it accordingly.

Remember pals, you need to know your damn IDE!

---

What are your favourite IDE keyboard shortcuts and why? Tweet us at @WeAreMobile1st and we’ll be sure to retweet your responses. If you’re interested in reading more of our IDE advice, you can check out our post on how to use IDEs effectively or our post on the simple XCode hack that could optimise developer productivity.

We Are Mobile First is a digital product agency based in Barcelona helping to transform businesses in a mobile-first world. Follow us on Twitter, LinkedIn and Medium to be notified of our future posts and stay up-to-date with our company news.

We share weekly content on everything from developer motivation to the benefits of Open Source projects.

(Hero image credit: Apple Developer)