Question about strict vim compatibility
frank.fischer at mathematik.tu-chemnitz.de
Fri Jan 27 08:44:21 CET 2012
On Thu, Jan 26, 2012 at 04:11:36PM +0000, Eric S Fraga wrote:
> From what I understand, evil strives to be, as much as possible,
> identical in behaviour to vim. I am wondering whether this need always
> be the case?
Many users use both, Vim and Evil, or come from Vim and thus are used
to the behavior of Vim. Therefore it's a good idea to keep Evil as
compatible to Vim as possible, especially in common operations,
otherwise the inconsistency would probably hit many users immediately.
> My query is related to something that has bothered me a long time in vi
> (and descendents): 'de' and 'dw' behave differently from 'ce' and 'cw'
> with respect to whitespace that may be present between the current word
> and the next. It would be nice to have 'cw' behave analogously to 'dw'
> and actually replace the whitespace as well...
Yes, the special case of 'cw' is in fact explicitly mentioned in the
Vim documentation. And 'cw' is certainly one of the most common
operations, that's why evil implements the same behavior.
But I agree that this is an inconsistency within Vim itself (although
documented). Unluckily the hint from the Vim-docs, using ":map cw dwi"
does not work in evil because of the way the keymaps are arranged in
evil. Therefore I added a customization variable
`evil-want-change-word-to-end' in 6c5bf608 which controls whether 'cw'
is treated specifically. If set to t (the default) 'cw' behaves as in
Vim, if set to nil 'cw' behaves like 'dw' + 'i'.
Hope that helps you.
More information about the implementations-list