How do I delete text probably multiple lines in vi(m)?
Tried the backspace button to delete. Works not!
Deleted lines of text.
How do I delete text probably multiple lines in vi(m)?
Tried the backspace button to delete. Works not!
Deleted lines of text.
By default, in Vi/Vim, backspace
does not work as we are used to] (cf :help bs
, in Vim).
If you are in Vim, you can set it to behave the way you want with:
:set bs=indent,eol,start
If you are in Vi only, I refer you to @user31264's answer.
Some most common delete commands:
Delete 123 lines from the current one: d123d or 123dd
Delete one line: dd
Delete 1 character: x
Delete 123 characters: 123x
Delete till the end of the current word (word is a sequence of alphanumeric characters, or one non-alphanumeric non-space character): dw or de
As above, word is a sequence of any characters except whitespace: dW or dE
As above, delete 123 words: 123dw, 123de, 123dW, or 123dE