[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to get vi to delete characters



On Sun, Jan 07, 2001 at 02:03:30PM -0500, DTi4565459@aol.com wrote:
> Most of the time I can get vi to insert characters after entering 'i'
> 
> Also know how to :wq etc
> 
> But I can't figure out how to delete characters: my book says
> ndd will delete N lines; but it doesn't work.  In insert mode,
> backspace key often changes case of letters.  Del key doesn't 
> delete anything.  

the main thing about vi (or vim) is that there are a bazillion
different modes that determine what you can and can't do.

in insert mode, you can type to add stuff, or backspace to
delete whatever you've added on this current insert. when you're
done inserting, press ESC (escape key) to get back to command
mode; THEN (in command mode) the 'dd' or 'x' or 'd2w' or '5s' or
'c}' type commands will delete or change things.

to get to the command mode from just about anywhere, press ESC
until you get beeped at. then delete whatever you want to:

dd = delete current line
d$ = delete from cursor to end of line
D = delete from cursor to end of line
d^ = delete from cursor to beginning of line
d} = delete from cursor to end of paragraph (empty line)
d{ = delete from cursor to start of paragraph (empty line)
dw = delete a word (right of cursor)
db = delete back a word (left of cursor)
x = delete char from under cursor
X = delete char to left of cursor (as if by backspace)

precede these with any digits to specify a count:
5dw = delete next five words
3db = delete three previous words
2d{ = delete two preceeding paragraphs
etc.

-- 
See, if you were allowed to keep the money, you wouldn't
create jobs with it. You'd throw it in the bushes or
something.  But the government will spend it, thereby
creating jobs.      -- Dave Barry

will@serensoft.com    ***    http://www.dontUthink.com/

volunteer to document your experience for next week's
newbies -- http://www.eGroups.com/messages/newbieDoc



Reply to: