From the course: Learning Vim
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Change text
- [Instructor] Open success.text. Vim success.txt. Say you'd like to change problems to challenges. First you'll move to problems with a regular expression, forward slash + p + enter. Now if you do d w to delete the word, it will delete the word, but you're still in normal mode, which means you have to press I to enter instant mode. For this we have the c command. The c command stands for change. It will delete the part of the text and will drop you to instant mode at the same time, c w. And now that you're in instant mode, you can write your changes, challenges. The first version was better. Hit escape to get back to normal mode and u to undo. As with other commands, you can use any motion with c. Let's change the first part up to have. Move to the beginning of the line with zero and then c + forward slash + h which means change up to where you find an h, and enter. And now we can write you should. Let's get back to the original text and quit. First escape, to get into normal mode…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Delete text1m 16s
-
(Locked)
Challenge: Delete sentence5s
-
(Locked)
Solution: Delete sentence15s
-
Copy and paste2m 2s
-
(Locked)
Challenge: Copy and paste6s
-
(Locked)
Solution: Copy and paste15s
-
(Locked)
Change text1m 25s
-
(Locked)
Challenge: Change text13s
-
(Locked)
Solution: Change text16s
-
(Locked)
Visual selection1m 55s
-
(Locked)
Challenge: Use visual selection6s
-
(Locked)
Solution: Use visual selection21s
-
(Locked)
Registers2m 36s
-
(Locked)
Challenge: Use registers11s
-
(Locked)
Solution: Use registers46s
-
Replace text1m 7s
-
(Locked)
-
-
-
-
-