Closed roycrippen4 closed 6 months ago
I also experience the same issues using cw
and dw
on the last word of a line.
This is pretty much the issue I described here: https://github.com/chrisgrieser/nvim-spider?tab=readme-ov-file#operator-pending-mode-the-case-of-cw
cw
and dw
behave as intended, since they move to the start of the next (sub)word. What you really want to do is use de
and ce
respectively. As described in the link above, you can also remap w
to e
in operator-pending mode, if you really prefer to use w
(even though it is in my view very inconsistent.)
Thank you for the explanation!
Feature Requested
The Problem:
While spider is more consistent than vim's default
w
,e
, andb
motions in most cases, one case where spider falls short, in my opinion, is at the end of lines.Below are several examples that show the differences between the current behaviors and expected behaviors.
Examples:
Behavior:
dw
on the last word of the last line.Expected Behavior:
dw
on the last word of the last line.Example -
dw
on the last word of last line:Sample (t)ext\n.
=>Sample (t)ext.\n
Sample (t)ext\n.
=>Sample ().\n
Behavior:
cw
on the last word of the last line.Expected Behavior:
cw
on the last word of the last line.Example -
cw
on the last word of last line:Sample (t)ext\n.
=>Sample |text.\n
Expected:
Sample (t)ext\n.
=>Sample |.\n
Behavior:
dw
on the last word of a line.Expected Behavior:
dw
on the last word of a line.Example -
dw
on the last word of a line:Sample (t)ext\n.
=>Sample ()
Sample (t)ext\n.
=>Sample ().\n
Behavior:
cw
on the last word of a line.Expected Behavior:
cw
on the last word of a line.Example -
cw
on the last word of last line:Sample (t)ext\n.
=>Sample |
Sample (t)ext\n.
=>Sample |.\n
The Solution:
There are two possible solutions to this problem.
These solutions can be made opt-in or default behavior - I don't mind implementing either.
Final Thoughts:
This may be a problem that is completely unique to me. But, I do find it frustrating that punctuation and newlines get removed when I use dw or cw at the end of a line. I wanted extra input before forking/solving/submitting a PR if this is a problem that nobody else cares about besides me.
Relevant Screenshot
No response
Checklist