You could use !.
Mark the lines you want to filter. Then hit !. The cursor will jump to the command line prefilled with
Then just type the filter you want to use. E.g.
To filter the entire file use
To only filter the current line, just hit !! and the command line is ...
Just use an ex command with searches for ranges:
Repeat with @:. Or, for the whole file,
You can make it a hotkey with dp
:nnoremap <leader>dp :g/^=[^\s]/,/^=cut/ delete<cr>
You can do the following mappings:
" *D*elete *P*od
nnoremap <leader>dp gg/^=[^\s]<cr>V/^=cut<cr>d
" *F*old *P*od
nnoremap <leader>fp /^=[^\s]<cr>V/^=cut<cr>jzf
To either delete the first POD of the file, or fold the next POD accessible from your cursor (if you are in a POD, only part of it will be folded)
You can probably use foldexpr to do this.
Here is a gist written by a person on the Internet. It defines a foldexpr function for folding the POD format.
I tried it on a random Perl script I found on this site (warning no https).
The foldexpr seems to work okay. It might work well enough for your use case that you can tweak it.
On the example script I ...