I want to format a block of text and I am using a range to select the leading comment of a function. It's all lines starting with // ...
.
I'm using the range
:?^[^\/][^\/]?+1,/^[^\/][^\/]/-1
to select backwards up to the first line not starting with //
, then plus one to get the the start of the comment, and similar thing for the forward search.
If I prefix this with a sed command like s,^,#,
this works. But if I use gq
or gw
as command it fails telling me Not an editor command: ...
How can I apply the text format command to a range?
gq
andgw
are normal commands: you can't enter them in command mode like:gq...
that's why you getNot an editor command
. You can usenormal gq
to use them in a script.