http://www.geocities.com/volontir/ I read following:
:g/^$/,/./-j
- reduce multiple blank lines to a single blank
I try to understand this, so let's break it up
:g/^$/
is the easy part: it marks all blank lines
,/./-j is a riddle to me,
Anybody cares to explain this to me?
Easy enough. The basic pattern, as you recognize is
:g/pattern/action
In this case, the action is, as you identify
,/./-j
What you have here is of the form
{range}j
That {range} is
{start},{stop}
If not specified, the current line is the default starting
location for most ex commands and ranges. That makes your
{start} the current line, and your {range} the same thing as
.,/./-j
which I prefer in my own vim-isms just to make it more readable.
Your {stop} is
/./-
This is
/./ search for the next line containing something
- go back/up one line from that line containing something
So what you have is
:g/^$/,/./-j
111111244435
1) on empty line
2) beginning on that empty line (the implicit ".") and continuing
through
3) the line preceeding
4) the next line containing something
5) join that range of lines together.
Hope that makes sense...? :)
-tim