loading...

Keyboard Shortcuts You Should Know

bouhm profile image Brian Pak Updated on ・4 min read

Whenever I watch experienced developers work with code, I'd always notice their uncanny ability to edit code very quickly and efficiently with various combinations of keys, rarely touching the mouse. And I was feeling very left out.

gotta-code-fast

a true professional at work

After diving into the world of keyboard shortcuts, I've compiled a list of keyboard shortcuts that I found to be the most useful. These are shortcuts used in Atom and Visual Studio Code, but most of these should be widely used across other editors.


Cursor Movement

⌨️  Move cursor by word

Editor macOS Linux Windows
Atom alt + / ctrl + / ctrl + /
VS Code alt + / ctrl + / ctrl + /

⌨️  Move cursor to beginning/end of line

Editor macOS Linux Windows
Atom cmd + / home / end home / end
VS Code cmd + / home / end home / end

Selection

⌨️  Select multiple by word (tap repetitively for consequent words)

Editor macOS Linux Windows
Atom cmd + d ctrl + d ctrl + d
VS Code cmd + d ctrl + d ctrl + d

⌨️  Select all occurrences of word

Editor macOS Linux Windows
Atom cmd + ctrl + g alt + f3 alt + f3
VS Code cmd + shift + l ctrl + shift + l ctrl + shift + l

⌨️  Create multiple cursors vertically

Editor macOS Linux Windows
Atom alt + / shift + alt + / ctrl + alt + /
VS Code alt + cmd + / shift + alt + / ctrl + alt + /

⌨️  Create multiple cursors arbitrarily

Editor macOS Linux Windows
Atom cmd + click ctrl + click ctrl + click
VS Code alt + click alt + click alt + click

⌨️  Select current line (or lines if multiple cursors)

Editor macOS Linux Windows
Atom cmd + l ctrl + l ctrl + l
VS Code cmd + l ctrl + i ctrl + i

Edit

⌨️  Delete current line

Editor macOS Linux Windows
Atom ctrl + shift + k ctrl + shift + k ctrl + shift + k
VS Code shift + cmd + k ctrl + shift + k ctrl + shift + k

⌨️  Delete from cursor left to right
Note: macOS 'delete' is comparable to 'backspace' and 'backspace' is different from 'del'

Editor macOS Linux Windows
Atom ctrl + d del del
VS Code ctrl + delete del del

⌨️  Move lines/selection

Editor macOS Linux Windows
Atom cmd + ctrl + / alt + / alt + /
VS Code alt + / alt + / alt + /

Alternatively, you can cut & paste:

Editor macOS Linux Windows
Atom cmd + x & cmd + v ctrl + x & ctrl + v ctrl + x & ctrl + v
VS Code cmd + x & cmd + v ctrl + x & ctrl + v ctrl + x & ctrl + v

⌨️  Comment/Uncomment Selection

Editor macOS Linux Windows
Atom cmd + / ctrl + / ctrl + /
VS Code cmd + / ctrl + / ctrl + /

Search

⌨️  Search for keyword in files

Editor macOS Linux Windows
Atom cmd + shift + f ctrl + shift + f ctrl + shift + f
VS Code cmd + shift + f ctrl + shift + f ctrl + shift + f

⌨️  Search for file name

Editor macOS Linux Windows
Atom cmd + p ctrl + p ctrl + p
VS Code cmd + p ctrl + p ctrl + p

Other Helpful Settings

Indent Guide
Atom's indent guide seems to be disabled by default. Enable it by doing:
Atom → Preferences → <> Editor → Check 'Show Indent Guide'

You can find the rest of the shortcuts for these editors at:
https://code.visualstudio.com/docs/getstarted/keybindings
https://flight-manual.atom.io/using-atom


The differing keymaps can get confusing, and there are more keymaps out there for keyboard shortcuts (including vim and emacs). If you're coding in an editor like Atom or VS Code, luckily you can stick to one keymap by using a keymap extension of your choice, or manually re-bind the keyboard shortcuts in the editor config.

Did I miss any helpful keyboard shortcuts? Have any keymaps or extensions to recommend? Feel free to share your loadout!

Posted on Mar 14 '19 by:

Discussion

markdown guide
 

thanks brian! just gonna go ahead and keep this tab perma-open for the next few months... ;)

 

That is cute. You left out, change/copy a string, change/copy arguments, repeat last edit, undo and replay edits I made before the current edits (because I liked that attempt better), increment number, move to matching brace/quote... Combined with, record these set of actions is awesome.

See I understand the missing shortcuts because Vim and emacs were missing from your editor list. These aren't trivial to learn editors, but there is reason those of us who have laugh in the face of keyboard shortcuts.

 

Haha I knew this would come up. Personally I'm used to using these editors and figured editors like vim/emacs were more advanced and not used by newer devs. I'll probably get there one day though.

 

I think learning vim was so worth it as a dev. Vim is almost everywhere.