Vim: delete empty lines within a visual selected area

vim

Solution

Select text visually, press : to enter command mode, and use the same command or use the `'<` and `'>` markers. E.g. `:'<,'><your command here>`.

For your particular use case, the final command would be:

:'<,'>g/^$/d

Problem

In ex-mode I can use `:g/^$/d` for the whole file. How to do it for a visual selected part of the file?

Original source