From the course: Learning vi

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Deleting text

Deleting text - vi Tutorial

From the course: Learning vi

Start my 1-month free trial

Deleting text

Now let's talk about deleting text. The command x deletes the character at the cursor. The command dd deletes the entire current line. The command dw deletes the current word, that is to say, from the current cursor position to the beginning of the next word. Whereas de deletes to the end of the current word. The difference between dw and de is that dw deletes any whitespace after the current word to the beginning of the next word, whereas de only deletes up to the whitespace that ends the current word. You can use d^ to delete from the current cursor position to the beginning of the current line, or d$ to delete from the current cursor position to the end of the current line. You can also use Shift+D to perform the same command as d$. In general you can use d followed by any movement command in order to delete that unit. So, just as you use w to move forward by a word, you use dw to delete a word. I'd like to point out a general principle here: d is the delete command, doubled, dd…

Contents