There are multiple ways to achieve what you want:
5elD
6f D
6wDx
6whD
# ... probably others too
All these cost you just +1 keystroke.
If deleting starting from current position +1 was possible, then it will make sense to ask for deleting from current position -1 too. It would raise the question about other commands too, for example deleting until the end of the file from the current line +1, -1, and so on.
How can this possibly work? I see only two possible ways:
- Pass a parameter to the existing commands to modify their behavior with the desired nuance. This will inevitably cost you +1 keystroke, so you won't be better off than what exists already
- Have a new keystroke for this behavior. Most keys on the keyboard already have something else more important and powerful to do, it would be a very tough choice to assign one of the unused keys for such a small functionality
So, I don't see a way to have something better than the current features :-)
I agree that it's a bit unfortunate that there is no "atomic" command to delete from the next character. I see the practical use of what you're asking: when cutting short a text, I often want to delete starting from a space character, because I don't want to leave trailing whitespace at the end of lines (Git complains about it, for example). And the w
and e
word jumping commands are not very suitable for this, as w
jumps to first letters and e
jumps to last letters, and there's no shortcut to jump on the space after a word, except explicit searches like f
. So I understand and even share your need. I just don't see where this can be squeezed in the existing functionality.
The best alternative I can think of is to record the action in a macro, let's say d
. At the end of a word (on the last letter), record like this:
qdlDq
Then, you can redo this action at the end of another word with @d
.
To do it repeatedly, you can do @@
.
When doing it repeatedly this is faster to type than lD
,
but this might depend on your taste.
If you don't do it repeatedly then the macro doesn't really help, as it's the same number of keystrokes anyway (+ the creation of the macro).
6wD
leaves a space after the last word, but at least the visible text is the way you want it.6wDx
finishes the job, but then you're at four keystrokes again.