Some Vi Commands Word Scramble
|
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Question | Answer |
vi -r filename | recover filename that was being edited when system crashed |
:x | quit vi, writing out modified file to file named in original invocation |
:wq | quit vi, writing out modified file to file named in original invocation |
:q | quit (or exit) vi |
:q! | quit vi even though latest changes have not been saved for this vi call |
j | move cursor up |
k | move cursor down |
h | move cursor left |
l | move cursor right |
0 (zero) | move cursor to start of current line (the one with the cursor) |
$ | move cursor to end of current line |
w | move cursor to beginning of next word |
b | move cursor back to beginning of preceding word |
:0 | move cursor to first line in file |
:n | move cursor to line n |
:$ | move cursor to last line in file |
u | undo what you just did |
i | insert text before cursor, until |
I | insert text at beginning of current line, until |
a | append text after cursor, until |
A | append text to end of current line, until |
o | open and put text in a new line below current line, until |
O | open and put text in a new line above current line, until |
vi filename | edit filename starting at line |
r | replace single character under cursor (no |
R | replace characters, starting with current cursor position, until |
cw | change the current word with new text, starting with the character under cursor, until |
cNw | change N words beginning with character under cursor, until |
C | change (replace) the characters in the current line, until |
cc | change (replace) the entire current line, stopping when |
Ncc or cNc | change (replace) the next N lines, starting with the current line, stopping when |
x | delete single character under cursor |
Nx | delete N characters, starting with character under cursor |
dw | delete the single word beginning with character under cursor |
dNw | delete N words beginning with character under cursor; e.g., d5w deletes 5 words |
D | delete the remainder of the line, starting with current cursor position |
dd | delete entire current line |
Ndd or dNd | delete N lines, beginning with the current line; e.g., 5dd deletes 5 lines |
yy | copy (yank, cut) the current line into the buffer |
Nyy or yNy | copy (yank, cut) the next N lines, including the current line, into the buffer |
p | put (paste) the line(s) in the buffer into the text after the current line |
/string | search forward for occurrence of string in text |
?string | search backward for occurrence of string in text |
n | move to next occurrence of search string |
N | move to next occurrence of search string in opposite direction |
:.= | returns line number of current line at bottom of screen |
:= | returns the total number of lines at bottom of screen |
control-g | provides the current line number, along with the total number of lines,in the file at the bottom of the screen |
:r filename | read file named filename and insert after current line (the line with cursor) |
:w | write current contents to file named in original vi call |
:w newfile | write current contents to a new file named newfile |
:12,35w smallfile | write the contents of the lines numbered 12 through 35 to a new file named smallfile |
:w! prevfile | write current contents over a pre-existing file named prevfile |
Created by:
ruprecht10
Popular Miscellaneous sets