How To Delete Single and Multiple Lines In Vim?
Vim provides different keyboard and command shortcuts. One of the most used action is
delete . Vim provides a lot of different use cases for deleting single and multiple lines.
Delete Current Line
Vim has cursor which will reside current active location. We can delete this line completely with the
Delete To The End Of The Current Line
Another useful shortcut for deletion is deleting from cursor to the end of current line.
Delete To The Start Of The Current Line
We can delete from current cursor positions to the start of the current line with the following command.
Delete Specified Number Of Lines
We can specify the line count we want to delete. We will use
d command two times where we will put the line count between
d commands like below. We will delete 5 lines from current line.
Delete Current Word
Words are separated with spaces from each other. We can delete current word where cursor locate can be delete with the following command.
Delete To The End Of File
We can delete from current location where cursor blinks to the end of file with the following command.
Delete To The Start Of File
We can also delete from current location where cursor blinks to the start of the line with the following command.