Several global commands in Vim give an error: fails: global recursive

I want to sort the paragraphs in my text according to their initials with the following global command:

g/_p/,/^$/mo$ 

It works alone. But when I use several global commands at once, an error occurs:

 g/_p/,/^$/mo$|g/_w/,/^$/mo$ 

This results in the following error:

 Cannot do :global recursive 

How can I run these commands sequentially right away?

+7
source share
2 answers
 :exe 'g/_p/,/^$/mo$' | g/_w/,/^$/mo$ 

See :help :bar

+7
source

Here are a few lines of vimscript that sort all paragraphs. But they recognize indented paragraphs rather than blank lines. But, of course, one could adapt it to highlight paragraphs with blank lines.

0
source

All Articles