Richard Vock
Richard Vock

Reputation: 1468

Delete till first character on next line

I have code that looks like this:

DataAssociator::Impl::Impl(const VoxelHasherSettings& settings_voxelhasher,
                           const CameraSettings& settings_camera)
{
    initialize(settings_camera);
}

When I position my cursor on the c of the first const and press either + or <CR> I move to the next const.

However pressing d+ / d<CR> deletes too much and leaves this:

{
    initialize(settings_camera);
}
  1. Why is that the case?
  2. How do I achieve the effect of deleting till the first character on the next line?

I am using neovim.

Thanks in advance, Richard

Upvotes: 3

Views: 77

Answers (2)

sidyll
sidyll

Reputation: 59277

Yet another option for this specific case: DJx

Upvotes: 1

Ingo Karkat
Ingo Karkat

Reputation: 172520

When you check out :help +, this mentions linewise. So when you use + in normal mode, it moves (as documented) to the first non-blank, but after an operator (like d or y), all touched lines will be included by default.

You can change that default behavior on a case-by-case basis via :help o_v: So dv+ instead of d+.

Alternatively, you can first go into visual mode; the selection will provide feedback on what text you'll be covering: v+d. A complication here is that depending on your 'selection' setting, this may select one character too much (with the default inclusive selection).

Upvotes: 6

Related Questions