Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore Vim's special case behavior for cw and dw #36

Closed
roachsinai opened this issue Sep 12, 2020 · 5 comments
Closed

restore Vim's special case behavior for cw and dw #36

roachsinai opened this issue Sep 12, 2020 · 5 comments

Comments

@roachsinai
Copy link

roachsinai commented Sep 12, 2020

In readme you provides two example:

Vim:

	^foo [b]ar$ -> dw -> ^foo[ ]$
	^ baz$               ^ baz$

	^[f]oo bar$ -> cw -> ^[ ]bar$

This plugin:

	^foo [b]ar$ -> dw -> ^foo [b]az$
	^ baz$

	^[f]oo bar$ -> cw -> ^[b]ar$

and recommend to use nmap dw de to restore Vim's special case behavior.

But when cursor located in the last word of one line, the Vim origin dw behavior like d$. Neither dw nor de provide by this plugin has same effect.

So am I misunderstand what you post? And expected dw of this plugin have same effect, i.e. d$, when delete the last consecutive characters.

Thanks in advance.

@chaoren
Copy link
Owner

chaoren commented Sep 12, 2020

The original vim implementation only sometimes causes dw to behave like de. When it's on a word at the end of the line it'll behave like de unless there's space after the word, in which case it'll behave like dw. The map suggestion just fixes it for most cases. If you're saying it's different from both dw and de, then please give an example. de behaves exactly the same as the original vim's dw in the example you're quoting.

@roachsinai
Copy link
Author

roachsinai commented Sep 12, 2020

A case:

		elseif type(text) == [3]
			let dcount = len(text)

for vim original dw returns:

		elseif type(text) == 
			let dcount = len(text)

for this plugin dw returns:

		elseif type(text) == let dcount = len(text)

for this plugin de returns(same with vim original de):

		elseif type(text) ==  dcount = len(text)

What expected is in above situation dw behavior provide by this plugin same with Vim original.

@chaoren
Copy link
Owner

chaoren commented Sep 14, 2020

I see. It's specific to a single character at the end of the line. de in this case will move to the end of the next word instead of the current one. There's not really a way to fix it aside from actually implementing the special behaviors for dw.

@chaoren chaoren changed the title restore Vim's special case behavior restore Vim's special case behavior for cw and dw Nov 28, 2020
@chaoren chaoren closed this as completed Dec 20, 2020
@chaoren
Copy link
Owner

chaoren commented Dec 20, 2020

@roachsinai @MasterMedo @alepinio @tmandry @oblitum Vim's special case for cw has been implemented. Please update the plugin and remove the nmap workarounds that were in the caveats section, and let me know if I missed any conditions.

@roachsinai
Copy link
Author

@chaoren , thank you so much for this update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants