There are times when you might feel like reaching for the mouse to execute a certain task. But we all know that shifting our hand to and fro from the mouse reduces our productivity. So,
Here are 10 keyboard shortcuts that will help you to speed up your coding process ๐งต
These shortcuts work with a majority of code editors and IDEs like VS Code, Atom, Sublime etc. If these doesn't work for you, make sure to check the settings of you editor.
Let's Begin ๐
1๏ธโฃ Copy/Cut/Paste Entire Line
You might be aware about Ctrl+C/X/V but there's a trick to it, if you don't select any portion in the line, your editor will copy/cut/paste the whole line including the line break.
2๏ธโฃ Comment and Uncomment Lines
Comments are extremely handy for us, but instead of going to each and every line individually and commenting it, just highlight whatever lines you want commented and then hit
Ctrl + /
This command will comment and uncomment the entire line
3๏ธโฃ Search for a file in your file
Navigating through a project can get hard, especially when the project is pretty big. You can just use
Ctrl + P
to search for any file in your whole project.
4๏ธโฃ Search for a keyword in a file and in the whole project
Searching for a keyword inside a file can be done using
Ctrl + F
and then pressing Enter will let you navigate through the keywords
To search in the whole project,
Ctrl + Shift + F
is used.
5๏ธโฃ Indent and Un-indent code
Select the code block that you need to indent and then press the Tab key to indent the whole code block.
Similarly, to un-indent the code block, select it and press Shift + Tab
6๏ธโฃ Create a new file
This might not be the most useful shortcut in bigger projects but you can create new files using
Ctrl + N
7๏ธโฃ Create a new line
Usually, when we have to create a new line, we place our cursor at the end of the line and press Enter, but pressing
Ctrl + Enter
will create a new line just below the line where your cursor is present.
8๏ธโฃ Navigate across the whole word rather than a character at a time
Ctrl + Arrow Key
will allow you to navigate across a whole word at a time as compared to just a character
Ctrl + Backspace
will allow you to delete a whole word at a time
9๏ธโฃ Highlighting characters and words
Holding down Shift key and pressing allow keys will allow you to highlight characters.
Similarly,
Shift + Ctrl + Arrow keys
will allow you to highlight a whole word at a time.
1๏ธโฃ 0๏ธโฃ The OG Shortcuts
Ctrl + S
-> Save the file
Ctrl + A
-> Select All
Ctrl + Z
-> Undo
Ctrl + Y
-> Redo
These are all the shortcuts you'll need to speed up your coding. Initially, it might be a little bit difficult to use them regularly.
You need to use these shortcuts consciously and in no time they'll get into your habit without you even knowing.
Top comments (22)
Shortcuts always helpful,
alt + arrow :: line or selected up or down
alt + shift + arrow :: copy line or selected up or down
By the way I never use mouse in my MacBook Pro 13 because touch bar is very smooth even the fast and precise momentum driven scroll up and down : best for take look the code.
Thank you for adding these Peter
One almost universal shortcut I use a lot is "Move from end of line to next/prev end of line". It's
right up left
to go up a line, andright down left
to go down a lineIt's a nice trick, quite handy.
The same can also be achieved with the Home and End buttons.
Yes, it's awesome
Also one of the less known shortcuts is
shift + alt + o
to organize imports, very cool to useI haven't heard of it, I'll try it out for sure
Vim or NeoVim FTW
Absolutely legend
haha yes
Ctrl+Enter is something new, thanks for sharing
You're most welcome Anees
I use home and end keys to navigate to the beginning and end of lines respectively
Yes, that's a great way!
In number 8 just correct world to word.
and thank you .
Thanks a lot for pointing it out๐
I'll correct it.
And I'm glad you liked it
Readers of this blog post will move to Vim/Neovim in next few years ๐
Hahaha๐
PageUp and PageDown are also really usefull when you want to get to the end or the start of a file.
It also becomes really handy when navigating webpages. When reading manwha for example :)
Yes, Page up/down buttons are underrated
Might want to list the Mac shortcuts too
These work for Mac too, just replace Ctrl with Command