textmatevim icon indicating copy to clipboard operation
textmatevim copied to clipboard

dw and cw are buggy

Open XManticore opened this issue 12 years ago • 2 comments

The delete word and change word command behave strangely, both by themselves and with a multiplier (e.g. d2w)

I'll use square brackets to show the cursor. In Vim, if I have the following text [d]isplacement.x(); timer.stop();

and press dw, I get the following result: [.]x(); timer.stop();

which is what you would expect: a word has been deleted and the cursor moves to just after where the word was. Using text mate, I get this instead: .x(); []timer.stop();

So the correct word has been deleted, but the cursor goes way after where it should be.

That is annoying enough, but at least the delete works. Unfortunately, when you try to delete two words (d2w), it doesn't work at all – it just moves the cursor. So if we start with our original text [d]isplacement.x(); timer.stop();

and then press d2w, we just get this displacement.x[](); timer.stop();

I suspect that in this case, the d command is being ignored and TextMate is just executing 2w, which works as expected.

It's a shame because the ability to do a command followed by an arbitrarily multiplied motion is one of the things that makes vi so efficient.

XManticore avatar Jul 27 '11 18:07 XManticore

Hey XManticore, thanks for the bug report. I suspect the behavior in the first case is because of the way TextMate implements word boundaries. I'll see if I can improve that. Regarding d2w, this is not supported at the moment out of oversight. I tend to use this syntax instead, which is supported: "2dw".

philc avatar Jul 27 '11 20:07 philc

Thanks for the quick reply. 2dw does work, although with the cursor movement still incorrect as per the first issue. Still, a definite improvement - cheers!

Also, thanks for this package in general. I'm new to Vim, and using it with TextMate is a fantastic way of learning it

XManticore avatar Jul 27 '11 20:07 XManticore