vi Commands Flashcards
What are the commands for switching between insert and command mode?
i for going into insert
esc for going back to command mode
What does the following command do: x
Deletes the current character
What does the following command do: dd
Deletes the current line
What does the following command do: u
Undo the last change
What does the following command do: /
Searches for the text to follow
What does the following command do: :w
Writes to the file
What does the following command do: :wq
Writes to the file and quits
What does the following command do: :q
Quits if no change has been made
What does the following command do: :q!
Exit without saving
What does the following command do for cursor movement: h
One character left
What does the following command do for cursor movement: j
Move one line down
What does the following command do for cursor movement: k
Move one line up
What does the following command do for cursor movement: l
move one character right
What does the following command do for cursor movement: w
Move to the next word
What does the following command do for cursor movement: e
Move to the end of the current word
What does the following command do for cursor movement: b
Move to the beginning of the previous word
What does the following command do for cursor movement: 0
Move to the beginning of the current line
What does the following command do for cursor movement: $
Move to the end of the current line
What does the following command do for screen movement: H
Move to the top of the screen
What does the following command do for screen movement: L
Move to the bottom of the screen
What does the following command do: ?
Searches backwards for something
What does the following command do: o and O
Open a new line below or (above) the current line
What does the following command do: i and I
Insert text before the current character or (at the beginning of the line)
What does the following command do: a and (A)
Appends text at the end of the current character or (at the end of a line)
What does the following command do: .
Redo the last modification command
What does the following command do: yy or Y
Copy the current line
What does the following command do: p
Paste
What is the syntax for searching and replacing in vi?
:(%)s/wordToFind/replacementWord/(g)(c)
% = in all lines g = find every occurrence c = ask for confirmation first