Vim delete range
Often I have a large SQL backup file I only need to extract a table and its information out of. To do this I’ve found that all you need to do is find the line you wish to delete up to and enter the following command.
This tells vim for the range 1 (line 1) to . (the current line), delete.
You can, of course, do something like:
But where’s the fun in that???
Then find the end of the section you wish and do the following command to delete until the end of the file:
This tells vim for the range . (the current line) to $ (last line of file), delete.
For more information about ranges check out this guide.