-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path10replacing.txt
52 lines (33 loc) · 1.46 KB
/
10replacing.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
10. Replacing text: r, R, ~ (tilde), c, C
---------------
We can use text replacements to edit more efficienctly.
To replace a character, we simply press place our cursor under the character we wish to replace, press "r", then press the new character.
r - replace a selected character with another
ra replaces selected character with "a"
3ra replaces three characters with "a"
Try replacing the incorrectly spelled character in this sentence.
Now try replacing four characters in this sentence.
We can also use substitution:
s - replace a char and add more
S - change the entire line
If you want to change the case of a letter, simply press the squiggly ~ (tilde).
This is located on the top left corner of your keyboard, below the ESC key.
~ - change the character case
3~ changes 3 character's case
every line should start with a capital letter. FBI
Now remember I told you that vim is a modal editor?
There's another nift mode called REPLACE. With it, you can write over existing text.
R - activate Replace mode
Press "R" and you replace as you go!
For a quick change, you can use the "c" key
c - delete and insert
cw - delete selected word and insert a new on
cc - change entire line, same as "S"
C - change line from where your cursor is
Try changing this line $ from the "$" symbol!
Review Questions:
1) Insert some random text into this sentence, then undo with one command.
2) Redo what you just undid in question 1.
Solutions:
1) "U"
2) ctrl+r