Using multiple cursors is easy! Mac: Option, Control, Up or Down. Windows: Control, Alt, Up or Down
image: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
Let's use multiple cursors with Posit's RStudio IDE. These can be super useful when you have to do finicky text manipulation tasks within a document or in your code. Let's see how all this works running through your options with an example. Suppose we have this artist table and we want to convert it to a vector of just the artists.
First, let's create a few extra cursors. We're going to use Option, Control, and then use the Up or Down arrow on a Mac, or Control and Alt and the Up or Down arrow on Windows. Now let's move around and select some text using the Shift and arrow keys. We're going to use Command and the arrow key to jump to the end of the line. Then use Shift and the Option key plus some arrows to select the comma and years. Note that we're selecting across multiple lines. And then backspace to delete that. And then on the keyboard, just Forward Delete to move all of these into one line. And now just a little bit of our code to convert these into a vector called artists.
Using the mouse for multiple cursors
So far in this example, we use just keyboard shortcuts to create multiple cursors across multiple lines, but you could also use your mouse. On Windows, use Alt and then click and drag to select multiple lines. And then on a Mac, hold