Is there a good reason why gJip
doesn't turn a paragraph into a line?
If not, how could I make it work that way?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityIs there a good reason why gJip
doesn't turn a paragraph into a line?
If not, how could I make it work that way?
The answer is simple: gJip
doesn't work, because gJ
is not an operator. See :h operator for which operators exist. The easy workaround is to use visual mode, and then join all the lines, e.g. use vipgJ
, because in visual mode gJ
will join all those selected lines (see :h v_gJ).
If you want to know the reason, why gJ
and also J
has not been implemented as an operator, you have to ask Bill Joy (for J
in original vi) and Bram Moolenaar (for gJ
only available in Vim). My guess is, that using e.g. a motion for the join operation does not always make sense, e.g. the command Jw
is non-sense.
gJ
is not an operator, that waits for a motion afterwards. You can however usevipgJ
to join all lines in the current paragraph. – Christian Brabandt Oct 26 '19 at 13:44vipJ
worked as well. – Toothrot Oct 26 '19 at 13:46vipJ
does something (slightly) different thanvipgJ
– Christian Brabandt Oct 27 '19 at 10:06