Tips on Using VI Editor (continued)
Changing multiple characters to uppercase
In visual mode, with the characters to change selected, press U (uppercase) to change them to uppercase. Press u (lowercase) to change them to lowercase.
In command mode, the same effect can be achieved on a single character by placing the cursor on the letter and press the tilde sign (~).
Jumping from line to line
You can jump from line to line by marking them first. To mark a line, press the key 'm' followed by a letter e.g. ma
This will mark the line your cursor is at in the buffer 'a'.
Then when you are at any other position in the file, press the aprostrophe key (') followed by the same letter e.g. 'a
This will bring the cursor (and the screen) to the line that you marked.
Shortcut Movement Keys
Aside from the arrow keys and the letters h, j, k, and l, there are other movement keys.
w
- move to the beginning of the next word
W
- move to the beginning of the next word following a space
b
- move to the beginning of the previous word
B
- move to the beginning of the previous word preceding a space
e
- move to the end of the next word
E
- move to the end of the next word following a space
(
- move to the start of the previous sentene
)
- move to the start of the next sentence
-
- move to the start of the line that is above the current position of the cursor
*
- move to the start of the line that is below the current position of the cursor
%
- find the matching bracket/brace of the one the cursor is positioned at