Highlight a word and press command d to select the next instance of it You now have multiple cursors! If you start typing, it'll enter in two places. If you hit command-d again, it'll select the next instance. Three cursors! Most normal text entry rules still apply... feel free to experiment.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
If you want to skip some instances, select the instance, then hit command-k before you hit command-d for the next instance. Takes some getting used to.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
You can also manually add a cursor by holding command and clicking or double-clicking elsewhere... this means you can select totally unrelated words.
Now let's combine the power of multiple selection with copy-paste! Maybe you've seen something like this before?
class Person attr_reader :first_name, :last_name, :email, :phone, :address def initialize(first_name, last_name, email, phone, address) @first_name = first_name @last_name = last_name @email = email @phone = phone @address = address end end
that's a lot of repetitive typing... can you figure out how to easily generate the rest of the class from here?
class Person attr_reader :first_name, :last_name, :email, :phone, :address def initialize() end end
Play around more with this kind of thing - it can save a lot of time since programs tend to repeat a lot of strings, variable names, etc.
If I wanted to delete or select a super-long word like antidisestablishmentarianism, do I really want to scroll all the way to the beginning or end to do it?
Put single quotes around me Put double quotes around me Put square brackets around me Put curly braces around me