I wanted to write a quick 'everything you will ever need to know about vi' file... something quick and simple that you can learn all the commands in a few minutes but from it be able to do everything you will need to get get basic stuff done. it won't be much use for any of your own knowledge but it's what I am giving to my new users so they are afraid of it. This one file should give them information about vi so that they can do basic edits to files yet provide enough advanced commands so they don't feel it's easier just to copy it to their windows desktop and work on it there.
so this is what I came up with:
so this is what I came up with:
Everything you need to know about VI to be an expert.
basic commands:
movement:
h = move left
l = move right
j = move down
k = move up
(look at your keyboard, l,j and k are your home keys for your
right hand)
Edit:
i = go into edit mode at the curser
a = go into edit mode before the curser
o = open a new line under the current line to edit
O = open a new line above the current line to edit
get out of edit mode: [esc]
delete:
d* where * is a movement key = delete the character/line in
that direction
dd = delete line (see advanced comands for more info on this)
D = delete the current line starting at the curser
other:
. = repeat the last command
u = undo the last command
/ = go into find mode
writing and exiting:
:wq = write and quit
:q! = quit but do not save changes
ZZ = same as :wq
more advanced commands:
entering a number... means do the next command that many times
for example:
70j = move down 70 lines
10dd = delete the current line and the 9 after it
p = paste what is in the clipboard to the file
yy = copy the current line to the clipboard
dd = cut the current line to the clipboard
:E [new file] = this will split your screen top to bottom and
open a new file (specified) into the bottom half of the
screen. You can switch between the two screens with a
[ctrl]w
Ex-pert, now a reformed pert.
Date: 2002-10-28 01:18 pm (UTC)Make sure you know what version of vi you are using, and if it is elVIs, VIm, or whatnot. Not all commands are everywhere.
Important cool additional commands....
c - change
cw - change word
c$ - change to end of line
d - delete
dw - delete word
w - movement key - move a word forward. W - move a word as defined by spaces, and not by semantics
b - movement key - move a word backward B - move back '' '' '''' ' ' ' ' '
just some more cool stuf used almost daily by your resident VIMaster
Re: Ex-pert, now a reformed pert.
Date: 2002-10-28 01:49 pm (UTC)I set a limit of 20 commands and went over by 1. I think I picked a good 21 of them.
Re: Ex-pert, now a reformed pert.
Date: 2002-10-28 01:50 pm (UTC)