Press Escape [Esc] to enter into command mode.

Press x to delete characters at the current cursor location

To delete n characters from the current cursor location we can use nx where n is the number of characters to delete.

For example if we want to delete 4 characters from the current cursor location we can do the following

Press Escape [Esc] to enter into command mode

Type 4x to delete four characters from the current cursor location

To delete the current line in vim type dd in the command mode.

Say, we have 5 lines in a file and the cursor is at the first line so the current line is 1. Now we want to delete 1st 2nd and 3rd line. In order to do this in vim we will do the following

Press Escape [Esc] to enter command mode

Type 3dd to delete 3 lines including the current line and the next two lines

For the earlier tutorial we saw that to move the cursor to the end of the line we type $ so to delete from the current cursor position to the end of the line we have to type d$

To delete from the current cursor location to the beginning of the line do the following

Press Escape [Esc] to enter into command mode

Type d0 to delete from current cursor location to the beginning of the line

Press Escape [Esc] to enter into the command mode

Type dG to delete from current line to the end of the file

To delete from the current line to the nth line we have to do the following

Press Escape [Esc] to enter into command mode

Type dnG to delete from current line to the nth line where n is an integer

For example, if we are at line 1 and type d3G it will delete line 1 to line 3 as n = 3 and we are instructions to delete from current line to the 3rd line.

Similarly, If we are at line 5 and want to delete from line 5 up to line 3 we type d3G

Recently Updated

- Product of Sums reduction using Karnaugh Map Boolean Algebra
- Sum of Products reduction using Karnaugh Map Boolean Algebra
- Karnaugh Map Boolean Algebra
- Sum of Products and Product of Sums Boolean Algebra
- Minterm and Maxterm Boolean Algebra
- Basic laws and properties of Boolean Algebra Boolean Algebra
- Propositional Logic Syllogism Boolean Algebra
- Propositional Logic Equivalence Laws Boolean Algebra
- Propositional Logic Important Terms Boolean Algebra
- Propositional Logic Truth Table Boolean Algebra