Reputation: 4807
I'm looking for a command to delete from the position after the cursor to the first non-whitespace character on the same line. I've tried several possibilities, and nothing seems to work. d2w comes closest, but deletes the character under the cursor.
e.g. I want to change this code
$obj->
set('foo')->
and('bar');
(note the leading spaces!) to
$obj->set('foo')->and('bar');
So I place the cursor on the first >
, hit d2w, and end up with $obj-set('foo')->
on a single line. Note the missing '>'.
What's the answer?
Thanks!
Upvotes: 1
Views: 95
Reputation: 1496
J
joins the current line with next line, but with a space, but deletes leading spaces in next line.
gJ
joins the current line with next line without space, but if second line contained leading space, it would be kept as it is. You can add a count before it to join n lines, like 3gJ
Example:
`3gJ` - join three consecutive lines without spaces.
In your case,
Jx - Join two lines with space and delete space
Give this command two times, like JxJx
for your case.
You can't give 2Jx, since J and x are two operators and 2 will be taken only for J alone. Further, gJ won't work in your case if second line contains leading spaces.
Upvotes: 1