aligrudi / neatvi

A small vi/ex editor for editing UTF-8 text
http://litcave.rudi.ir/
305 stars 25 forks source link

deletion of newline with dw #28

Closed kyx0r closed 3 years ago

kyx0r commented 3 years ago

Hello @aligrudi when using dw to delete a word if the word is touching the \n the \n is deleted also. Is that a bug or a feature? I know that busybox vi does not delete the \n

kyx0r commented 3 years ago

One thing to note that this can be worked around if you use de or dE in this situation, or ce or C and it will not wrap into next line

aligrudi commented 3 years ago

Kyryl notifications@github.com wrote:

One thing to note that this can be worked around if you use de or dE in this situation, or ce or C and it will not wrap into next line

The behaviour of dw seems implementation dependent. In Vim, dw does not remove the words on the next line, unless a count of at least 2 is specified. Elvis has almost the same behaviour, except that dw does not remove words on the next line, even if a count is provided.

In Neatvi (see lbuf_wordbeg() in mot.c), dw stops when removing a blank line (two consecutive new line characters). Actually, dw always deletes until the destination of w command, and unlike some other implementations does not consider special-cases for dw. I am not sure, but it seems more consistent.

Ali
kyx0r commented 3 years ago

Yes, I think this is actually fine to stay like that, it was just weird to me that it worked this way. But I just have to adjust my editing skills to use different key combo in those situations.