DEV Community

Cover image for 39 No Frills Keyboard Shortcuts every Developer Should Know About

39 No Frills Keyboard Shortcuts every Developer Should Know About

Chris Bertrand on September 04, 2018

[Edit] What used to be 27 is now 39 - Due to all the great comments, I've amended the list to add a few more suggestions, thanks to all that contri...
Collapse
 
leoat12 profile image
Leonardo Teteo • Edited

I use both VS Code and InteliJ IDEA daily to do my work, when I saw the Crtl + Y shortcut I thought that I would warn InteliJ IDEA users that it is totally different in this IDE and can be potentially "dangerous". hahaha
Here is a reference card for InteliJ IDEA to contribute to the shortcut movement. :)

Collapse
 
chris_bertrand profile image
Chris Bertrand

Haha! Yeah I've maybe I need a disclaimer somewhere! I've fallen for that on other IDE's too. For anyone wondering, this will delete the line you are on! Quite the opposite from Redo in most ways! :D

Collapse
 
felssca profile image
FelipeSSCA

Nice!!Thanks!

Collapse
 
yucer profile image
yucer

A long time ago, before Windows...

The code editors use to have this combination of keys that still work today.

CURSOR MOVEMENT:

  • ARROWS -> move character by character

  • CTRL + ARROWS -> move word by word

  • HOME -> Go to the first character of the line

  • END -> Go to the last character of the line

  • CTRL + HOME -> Go to the start of the file

  • CTRL + END -> Go to the end of the file

SELECTION:

  • SHIFT + CURSOR MOVEMENT -> move selecting text

COPY & PASTE:

  • CTRL + INS -> Copy the selected test TO the clipboard (COPY)

  • SHIFT + DEL -> Move the selected test TO the clipboard (CUT)

  • SHIFT + INS -> Move the selected test FROM the clipboard (PASTE)

Since those times I program with that COPY & PASTE combination. There is less movement of the hands. Once you get used to it, you will find that CTRL + C and CTRL + V combinations are not so ergonomic.

For example, in order to move a block of code from one place to another, I use to press:

  • HOME : go to the first position of the line
  • SHIFT + ARROW DOWN : select lines all the way down.
  • SHIFT + DEL : cut the block.
  • CURSOR MOVEMENT until the first position of the line where the code is going to be inserted.
  • SHIFT + INS : to paste the block.

You can see that in all that process, the left hand have only made the slight movement of pressing and releasing SHIFT, and not the complicated movement of pressing CTRL + C / CTRL + V. The right hand did only use the arrows (better if it is from the numeric keypad, so that HOME and END can be reached with an slight movement of the right index finger)

Collapse
 
chris_bertrand profile image
Chris Bertrand

Thanks, I've added a selection of these to the main post. Funnily I use quite a few of these in my bash terminal! ;)

Collapse
 
arulugearhaus profile image
Arulu-Gearhaus • Edited
Some other handy Chrome shortcuts - good for tab hoarders (like me)

Ctrl-D - Add bookmark for current tab (will put the bookmark in the last folder location you chose automatically)
Ctrl-W - Closes a tab

If you're frequently needing to find guides or lookup mysterious exceptions...

Ctrl-T - Opens a new tab, and in Chrome it puts the cursor in the address bar - great for quickly going somewhere else (or using Chrome as a calculator, as I often times do)
Ctrl-K - moves cursor to the address bar and changes the address bar to a google search.

Some generally useful hotkeys (work in many apps, not just text editing)

ctrl+A - will select EVERYTHING
ctrl+X - Cut. Works like the Copy hotkey, but also deletes the selection. A great tool for quickly refactoring code.
If used in the File Explorer, Cut-Pasting a file doesn't delete it, but instead moves it from one place to another. If you're moving the file(s) from one place to
another on the same drive, this can be nearly instant. If you don't need to have two copies of the same thing, consider using Cut instead.

As for as general text editing shortcuts

shift+end - will select from your cursor to the end of the line.
shift+home - will do the same as above, but to the beginning of the line instead.

VSCode has some other handy shortcuts for cursor manipulation (other IDEs have similar functionality w/ different hotkeys)

Alt+Up/Down Arrow - Shifts the current line the cursor on up or down. If you have multiple lines selected - they will all move

Ctrl+Alt+Up/Down Arrow - similar to Ctrl+D, but instead of creating a new cursor at every instance of a word or selection, it just duplicates the cursor on lines above or below at the same horizontal position. Once you have these multiple cursors, you can manipulate them as if each was it's own individual cursor so the shift and ctrl + arrow hotkeys in the article work here too - but with multiple cursors. Ctrl-D does exactly the same thing in terms of the cursors it creates, just that it 'jumps' instead.

Shift+Alt+F - Auto Format. Formats the file according to VSCode defaults, or you can define overriding format rules in your user settings. You can also make use of one of the many plugins for formatting. I often use this if I refactor a section of code - but the formatting then needs to be re-done.

Also, perhaps not a hotkey per se, more shorthand than shortcut - but VSCode and a number of editors support RegEx search queries - it's on occasion been invaluable to find things that don't all exactly match. I've used it to quickly search things like log files or any large file really. (for example - you could write a query to find serial numbers or mac addresses in a file, without knowing their exact values. Saved my bacon a few times when trouble shooting bluetooth issues in a mobile app.)

Collapse
 
chris_bertrand profile image
Chris Bertrand

Great tips, thanks for sharing. Ctrl+K in a browser is a great one!

Collapse
 
codevault profile image
Sergiu Mureşan

Great list! Didn't know about Alt + Left, gonna try it today at work. I'll be adding some that I use daily and haven't been covered in this list.

More for VSCode:
CTRL + D - multi cursor select next occurrence
CTRL + SHIFT + L - multi cursor select all occurrences in file
CTRL + ALT + UP or DOWN - multi cursor next line up/down
CTRL + / - comment or uncomment
CTRL + P - quick search file

And some for VS:
CTRL + , - quick search definition and/or file
SHIFT + ALT + UP or DOWN - multi cursor next line up/down
CTRL + SHIFT + U - to upper-case
CTRL + K and CTRL + D - format whole file

Collapse
 
dance2die profile image
Sung M. Kim

Thanks for the list Chris.

To add one more, I believe only one keyboard shortcut is worth mentioning for browsers.

ctrl + shift + t

It opens previously closed tab, which saved me multiple times.

Collapse
 
chris_bertrand profile image
Chris Bertrand

This one is great, thanks. I've added to the main post under Browser Shortcuts!

Collapse
 
dance2die profile image
Sung M. Kim

🕺💃

Collapse
 
theredpanda17 profile image
Caleb Robinson • Edited

Don't forget these!
SHIFT + CLICK will open a new instance of a program.
SHIFT + CTRL + P or F1 will open up a list of useful commands in VS Code (like refreshing the window).
MIDDLE CLICK or SCROLL CLICK to open links in new tabs or to close a tab.

Collapse
 
rustyf profile image
Russ Freeman 🇪🇺 #FBPE

Windows - SHIFT + CTRL + CLick open as Administrator 👌

Collapse
 
drozerah profile image
Drozerah • Edited

Generic Windows Shortcuts

1 : open and display folder contents in Windows Explorer from terminal

Navigate to the folder you want displayed in Windows Explorer by using the Change Directory command cd then type the following command

start .

2 : quickly change display settings

If you were to skipping between "PC screen only", "Duplicate", "Extend", "Second screen only", simply use Windows + p shortcut

Collapse
 
stealthmusic profile image
Jan Wedel

I love shortcuts! I have one or two for you:

[WIN] + [SHIFT] + Left/Right - Moves the current window in its current size across multiple screens. Use that one all the time when working with multiple displays.

Collapse
 
chris_bertrand profile image
Chris Bertrand

Ooh cool, didn't know you could use Shift there too! Thanks for the tip.

Collapse
 
amit_savani profile image
Amit Patel

My personal favourite to delete word

  1. Ctrl + Backspace - Delete word on right of cursor position
  2. Ctrl + DEL - Delete a word on left of the cursor postion
Collapse
 
wayfarer_youth profile image
kristian

I'd recommend Vimium for Chrome. Browsing with your keyboard is amazing

Collapse
 
rupeshiya profile image
Rupesh Krishna Jha • Edited

Can you give some shortcuts for developing in atom editor ?

Collapse
 
chris_bertrand profile image
Chris Bertrand

I'll be honest, I've never used Atom before, but this cheatsheet package looks the business.

atom.io/packages/atom-shortcuts

Collapse
 
rupeshiya profile image
Rupesh Krishna Jha

thanks man!

Collapse
 
inclushe profile image
Ethan

You can also toggle comments (in VSCode at least) by selecting your block of code and hitting CTRL + /.

Collapse
 
chris_bertrand profile image
Chris Bertrand

I didn't know this one, it's actually even easier! Thanks

Collapse
 
julesmanson profile image
jules manson • Edited

ADJUST MOUSE TO MAXIMUM SPEED AND ACCELERATION

I wish to add a non-keyboard but related command. Maximize the speed of the mouse movement. Also if you have acceleration make it maximum. I know Windows has this but not sure about Apple. It will only take a few minute to get used to this but once you have done it there is no way you will ever go back to that slow dragging movement of the mouse. It will also help to prevent tennis elbow of the wrist if you are someone whose on the computer 24/7 such as I.

Collapse
 
elie222 profile image
Elie

You missed the most important one:

command + D - Multi Cursor, Select next occurrence

Collapse
 
lodo1995 profile image
Lodovico Giaretta

Windows + Tab = applications history (quite recent new feature)

Collapse
 
alvinmilton profile image
Alvin Milton

Thank you.

Collapse
 
chris_bertrand profile image
Chris Bertrand

Awesome, Thanks!

Collapse
 
sandordargo profile image
Sandor Dargo

Oh, great, thanks! Most of the Windows shortcuts work on my Ubuntu as well!

Collapse
 
apatton090 profile image
ap123

Oh wow this was super useful, just what I was looking for. Thank you!

Collapse
 
chris_bertrand profile image
Chris Bertrand

Sometimes GIFs make everything better, today is one of those days! :)