![]() They are all fairly common and you most likely know them all already. Everything ElseĪs I said at the start of this article I actually have a few more than 10 shortcuts, so here are the last few shortcuts that you need to know. You can even combine this with the previous shortcut by pressing ctrl + shift + left/right arrow to highlight entire words at a time instead of just one character. This is great for selecting small typos in your code to fix or to select small sections of code to copy and paste. If you want to highlight a section of code next to your cursor you can use shift + left arrow and shift + right arrow to move your cursor one character at a time to the left or right and also highlight the character you move over at the same time. This shortcut becomes even more useful when combined with the next shortcut. This is great for quickly moving across a line of code or getting to the end of a long word. Doing this with the mouse is slow and cumbersome so instead use the shortcut of ctrl + left arrow and ctrl + right arrow to move your cursor to the left or right by an entire word at a time. Moving your cursor through code is incredibly important since you commonly need to change code in different parts of the same file. This is a bit of a pain to do so instead you can just press the shortcut ctrl + enter and a new line will be added below your current line without needing to move your cursor to the end of the line. Normally if you want to add a new line below your current line you need to move your cursor to the end of the current line and press enter. This will immediately open a new file for you to work in. ![]() Normally this is done with the mouse by selecting the new file button, but you can actually create a new file just by typing the shortcut ctrl + n. While programming a new feature you are sure to create many new files. If you need to un-indent code it is as easy as pressing shift + tab and now all the selected lines of code will un-indent by one tab. ![]() This will indent all the lines of code by one tab. Luckily, you can easily indent a group of code by highlighting multiple lines of code and pressing tab. Keeping consistent indentation in your code is a pain since indentation is so easy to mess up and fixing it by always placing your cursor at the start of the line is annoying. ![]() This is incredibly useful when refactoring code. To do that you can just press ctrl + shift + f and that will open a search box that will search for the entered text across all files in your current project. Sometimes you need to search across your entire project, though. This will open a search box that you can type into and it will find all matches to your search within your current file. If you need to search for a particular set of text inside of the file you have open just press ctrl + f. This next shortcut is one you probably are already aware of, but it is incredibly helpful nonetheless. This makes finding the exact file you are looking for so much quicker since you never need to leave your keyboard to go searching for it. By pressing ctrl + p you can open up a search box which will search all of the files in your project for whatever you type into it. If you spend time searching through the hundreds of nested folders in your sidebar to find a particular file then you are wasting time that can be saved by a keyboard shortcut. Also, if you do not have any code highlighted at all when pressing this shortcut it will comment out the line your cursor is on which is really useful for quickly turning on or off logging statements. This can be tedious to do manually which is why most editors allow you to comment out all of the code on the lines you have highlighted by pressing ctrl + /. When you are writing or debugging code you commonly need to comment out individual sections/lines. This is probably the shortcut I use the most. You can do the same thing with ctrl + x to cut a line and paste it somewhere else which is incredibly useful. Then if you press ctrl + v it will paste the entire line directly above the line your cursor is currently on. If you just place your cursor on a line without highlighting anything and press ctrl + c it will copy the entire line your cursor is on including the line break. You are probably already familiar with how to cut/copy/paste highlighted sections of code by using ctrl + x, ctrl + c, and ctrl + v respectively, but you can actually take this a step further by copying an entire line at a time.
0 Comments
Leave a Reply. |