Multiple cursors
Last updated
Last updated
One of the most powerful things in modern text editors is the concept of multiple cursors. People usually have trouble understanding when you would ever use this feature. In this section we'll see a few places where you might use multiple cursors.
In the "app.js" file, use multiple cursors to rename the currentColor
variable to lampColor
.
Select the first instance of currentColor
Notice that the editor highlights other instances of the word in the file
Press Cmd/Ctrl + Shift + L to add a cursor to every instance of the word
Change it to "lampColor"
You may have noticed that when you did this, you changed the variable instance and the reference to the HTML element. This would break the application.
Instead of adding a cursor to every instance, sometimes you just want to add it to a few. You can select instances incrementally by pressing Cmd/Ctrl + D.
If you want to skip over an instance, press Cmd/Ctrl + K + D. Use this method to select just the instances of the variable and not the HTML element referenced.