Accidentally I managed to copy-paste a paragraph in vim a zillion times. How do I select and then delete the text from my current position to the end of file?
In Windows, this would be Ctrl-Shift-End, followed by Delete.
|
Accidentally I managed to copy-paste a paragraph in vim a zillion times. How do I select and then delete the text from my current position to the end of file? In Windows, this would be Ctrl-Shift-End, followed by Delete. |
|||
|
|
Enter visual mode, go to end of file, delete. Alternatively, you can do:
To delete from the current position to the beginning of the file. |
|||||||||||||||
|
|
d is delete and G moves to the end of the file, so dG will delete to the end of the file. It includes the entire current line though; if you're mid-line and want to preserve everything before the current position you need to use Mark's method |
|||
|
|
|
You could also just type u to undo the changes that resulted in the errant copy-paste. |
||||
|
|
|
Yet another method: That means in ex mode, address current line to end, and delete. |
|||
|
|