There are commands that start it's action as soon as you issue it, and there are some that requires additional arguments.
For example, ^
moves cursor to the first character on the line right away, but y
requires additional argument to start executing.
key stroke | Description |
---|---|
shift+j |
join lines |
g shift+j |
do not add space when joining lines |
~ |
change character under caret to uppercase |
g ~ {motion} |
change the sequence covered by motion to uppercase |
key stroke | Description |
---|---|
f {char} |
find the char on the line |
F {char} |
find the char on the line, backwards |
f {char} , ; repeat |
repeats the search |
f {char} , , repeat |
repeats the search in opposite direction |
t {char} |
Position cursor one position before the given char |
T {char} |
Position cursor one position before the given char , backwards |
Consider the following string
Delete THIS<<-- word.
To delete the THIS<<--
we can do
- Position cursor under
T
withf T
d t w
ord f [space]
ord [Shift]+w
or
key stroke | Description |
---|---|
/ {word} |
search word subsequently n repeat N repeat opposite direction |
? {word} |
search for word backwards. n repeats N repeats in opposite direction |
* |
find the next occurence of the word under or nearest to the word under the cursor |
# |
find the next occurence of the word under or nearest to the word under the cursor, backwards |
Combine commands::
- If we do
d /This
, vi will delete everything from current cursor to where it foundThis
. - If we are at the start of a line, and do
"a y /z
, vi will yank characters from the currect cursor to the first occurence of characterz
to registera